Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate our docs to other languages #350

Open
sfmig opened this issue Nov 22, 2024 · 0 comments
Open

Translate our docs to other languages #350

sfmig opened this issue Nov 22, 2024 · 0 comments
Labels
enhancement New optional feature

Comments

@sfmig
Copy link
Contributor

sfmig commented Nov 22, 2024

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

  1. From the docs folder, run make clean html
  2. Run make gettext
    ----> generates .pot files under build/gettext/
  3. Run sphinx-intl update -p build/gettext -l de
    ----> generate .po files under locales/de/LC_MESSAGES
  4. 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.
  5. Add translations to messages in .po files using the translate.py script
    python translate.py <language-code> <po-files-directory>
  6. 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New optional feature
Projects
Status: 🤔 Triage
Development

No branches or pull requests

1 participant