Local translation of sphinx internal messages ignored / not working

54 views
Skip to first unread message

Jonas Camillus Jeppesen

unread,
Aug 12, 2019, 6:44:02 PM8/12/19
to sphinx-users
Hi everyone,

I'm dissatisfied with certain Danish translations of the internal sphinx messages, so I am trying to overwrite a few select ones locally, but it is not working. My locally changed translations are not used.
I'd appreciate it if someone would take a look at my minimal working example and tell me if I'm doing something wrong.

My minimal working example is here: https://yapb.in/ramN.zip : it is just the output of `sphinx-quickstart`, an added `.. code-block::`, added file locale/da/LC_MESSAGES/sphinx.po and modified conf.py.

To build it (have sphinx 1.8 or 2.0 installed):
unzip test-locale.zip
cd test-locale
make html

Here is what I am doing and why I think it should workd. This http://www.sphinx-doc.org/en/master/usage/configuration.html#confval-locale_dirs directly states that internal message translations will be fetched from "./locale/language/LC_MESSAGES/sphinx.mo" (compiled from sphinx.po file using msgfmt).

So I added a "locale/da/LC_MESSAGES/sphinx.po to the root of the demo project (created by sphinx-quickstart). The content of the sphinx.po file is taken from https://github.com/sphinx-doc/sphinx/blob/master/sphinx/locale/da/LC_MESSAGES/sphinx.po but with updated values which should be easy to spot i the output.

conf.py contains the following:

language = 'da'         
locale_dirs = ['locale/']
gettext_auto_build = True
gettext_compact = False 

If I build the html (make html) an .mo file "locale/da/LC_MESSAGES/sphinx.mo" is created (because of the gettext_auto_build option), so I figure I'm doing something right. Anyway, the html output does not use the translations. "Listing x.y" is still translated as "Viser x.y" not "ShowYourSelf x.y" etc.

Any help would be appreciated.

/ Jonas

Jonas Camillus Jeppesen

unread,
Aug 13, 2019, 5:49:43 PM8/13/19
to sphinx-users
It turns out this works if I set the language to `en` and change `locale/da/` to `locale/en`, so I submitted an issue about it: https://github.com/sphinx-doc/sphinx/issues/6640

It seems like an unexpected behavior at least.
Reply all
Reply to author
Forward
0 new messages