Contribute to Internationalization of the Documentation

Generate Translation Files

Note

In most cases, translation files (with the extension .po) have already been generated in the project. If you just want to edit existing translation files, you can skip the Generate Translation Files section and proceed directly to Translate the Documentation.

Warning

I am only aware that the following steps work on Windows and macOS

You are welcome to test the effectiveness on other systems or suggest corresponding methods.

Note

Translation process can be referred from https://www.sphinx-doc.org/en/master/usage/advanced/intl.html

  1. Install Necessary Environment

Assuming you have forked the repository and cloned it locally.

Navigate to the project folder using cd JAnim:

Then, install the necessary environment using the following command:

pip install -e .[gui,doc]
pip install sphinx-intl
  1. Extract Translatable Text

cd doc

navigate to doc/ folder, and run the following command:

./make gettext

or (on macOS)

make gettext

This will extract translatable text, and the generated pot file will be located at doc/build/gettext/

  1. Generate po Files

Pot file contains extracted translatable source language text. You need to use these files to generate po files for corresponding languages.

sphinx-intl update -p build/gettext -l de -l ja

After execution, the generated po files will be located in the following folders:

  • doc/source/locales/de/LC_MESSAGES/

  • doc/source/locales/ja/LC_MESSAGES/

where de and ja correspond to the parameters provided in the above command.

Note

Here, de indicates German, and ja indicates Japanese, indicating that you want to work on translating to these languages.

For example, if you want to work on translating to English, then execute

sphinx-intl update -p build/gettext -l en

which will generate translatable files in doc/source/locales/en/LC_MESSAGES

Translate the Documentation

Assuming you want to translate to English

Now the po files (with the extension .po) are already stored in doc/source/locales/en/LC_MESSAGES

It is recommended to use Poedit software to open the po file in the directory and start translating.

Note

If you have the ability to check the translation, using GPT for translation is fine (but remember to proofread it).

Note

基类::py:class:`......`

For texts like this that require translation, you can either ignore them or copy them completely into the result.

Because this actually doesn’t need manual translation.

After translating, submit your changes and create a Pull Request to merge into the main branch.

Build the Documentation Locally

Note

Don’t forget to install the necessary environment

pip install -e .[gui,doc]

Make sure you are in the doc/ directory first:

cd doc

For example, if you want to build the documentation for zh_CN (Simplified Chinese) locally, you can execute:

.\make_i18n zh_CN

This will generate web files under build/html_i18n/zh_CN, and you can open index.html in it.

For other languages, simply replace zh_CN with the corresponding language code.