Reputation: 563
I'd like to overwrite admonition labels.
Admonitions are directives such as note
, warning
, and so on.
For Japanese, the labels are defined in https://github.com/sphinx-doc/sphinx/blob/master/sphinx/locale/ja/LC_MESSAGES/sphinx.po.
Is there a simple way to overwrite them without changing the master repository?
Upvotes: 0
Views: 449
Reputation: 50947
Here is what works for me (tested with Sphinx 3.3.1):
Copy the Japanese sphinx.po from <sphinx_install_dir>/sphinx/locale/ja/LC_MESSAGES/
to <your_sphinx_proj>/locales/ja/LC_MESSAGES/.
Note the directory name locales (the default value of the locale_dirs
configuration option).
Edit msgstr
for the relevant entries (admonitions in this case) in the copy of sphinx.po.
It is not necessary to keep the entire copy. You can remove the unchanged entries if you want.
Run sphinx-build with language=ja
(set it in conf.py or on the command line). A local project-specific sphinx.mo file is generated and used in the build.
This means that there will be two *.mo files for the same domain ("sphinx"). The local sphinx.mo is consulted first, and the original sphinx.mo that comes with Sphinx is used as the fallback.
Upvotes: 1