Generate files for translation¶
Generating files for translation is a two step procedure:
Generating .pot files, which contain the source strings and empty strings for further translation. Those empty strings in the .pot files are never filled with translation though. Instead, each .pot file is used as a template for as many language specific .po files as you need.
Generating a set of .po files for every language. In our example, we will generate index.po and easter-egg.po for Russian and Portuguese.
Generate files for translation:
Generate .pot files:
make gettext
The index.pot and easter-egg.pot files should appear in the _build/gettext directory.
Generate .po files:
sphinx-intl update -p _build/gettext -l ru -l pt_BR
Demo project directory should now contain the locale directory, whose name we specified earlier in conf.py. Inside the locale directory there are two directories: ru for Russian and pt_BR for Portuguese. Each of these two directories contains the LC_MESSAGES directory with index.po and easter-egg.po files inside:
locale │ ├───pt_BR │ └───LC_MESSAGES │ easter-egg.po │ index.po │ └───ru └───LC_MESSAGES easter-egg.po index.po