You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to build the documentation in another language
From the docs folder, run make clean html
Run make gettext
----> generates .pot files under build/gettext/
Run sphinx-intl update -p build/gettext -l de
----> generate .po files under locales/de/LC_MESSAGES
mv locales source
---> From the docs, I am not sure why locales is not created under source by default, but otherwise it won't pick up the translations
in the .po files.
Add translations to messages in .po files using the translate.py script python translate.py <language-code> <po-files-directory>
Build the html files form the translations make -e SPHINXOPTS="-D language='de'" html
Some observations
Some default sphinx bits get translated automatically which is nice.
For example, Search --> Suche.
In principle, the main bits of text need to be translated manually but this can be automated. I had a go at using a wrapper around google translate API (following this gist) in the translate.py script.
With the steps specified above we overwrite our build dir, but ideally we generate it separately directory (like _build). This seems very possible from the references above, just needs a bit of digging.
An even nicer implementation is to eventually treat different languages as different versions of the docs.
Once this is polished, it would be nice if we wrap the sphinx commands in make.
The text was updated successfully, but these errors were encountered:
I had a go during our hackathon at translating our docs --> work on this branch smg/docs-language
References:
How to build the documentation in another language
make clean html
make gettext
----> generates .pot files under
build/gettext/
sphinx-intl update -p build/gettext -l de
----> generate .po files under
locales/de/LC_MESSAGES
mv locales source
---> From the docs, I am not sure why
locales
is not created undersource
by default, but otherwise it won't pick up the translationsin the
.po
files.translate.py
scriptpython translate.py <language-code> <po-files-directory>
make -e SPHINXOPTS="-D language='de'" html
Some observations
translate.py
script.build
dir, but ideally we generate it separately directory (like_build
). This seems very possible from the references above, just needs a bit of digging.The text was updated successfully, but these errors were encountered: