ros2_documentation icon indicating copy to clipboard operation
ros2_documentation copied to clipboard

Multilanguage support and GitHub Actions

Open cychitivav opened this issue 2 years ago • 2 comments

As discussed in #3249, the support for multiple languages is a barrier that we can eliminate in the ROS learning curve. To address this, I have put forward a solution in #3678, building upon the feedback from the previous issue and as discussed with @clalancette. I am opening this PR for review, and I welcome any suggestions or comments to further enhance the proposal.

Process

To translate rst files, some tools are used following the following process:

image

This process can be somewhat simplified with the help of the sphinx-intl library:

  1. Upload .rst files with the documentation in English.
  2. Generate a .pot file from the .rst files using make gettext (these files would be stored in the build folder).
  3. Update the .po files with the .pot files using sphinx-intl update -p build/locale -l <language>.
  4. Translate the .po files manually or with the assistance of a translator.
  5. Build the documentation in the desired language using make -e SPHINXOPTS="-D language='<language>'" html (the output would be stored in the build/<language> folder).

File handling is better described in #3678, but I am still willing to answer questions or concerns in this PR.

cychitivav avatar Aug 14 '23 15:08 cychitivav

I have finished the configurations. Now I just have a few considerations:

  • Running the commands make multiversion and make html remains the same. I only added a new variable LANG to specify the language. However, by default, it's set to English, so running them without specifying the language will work as before.
  • An adjustment needs to be made in the pages to separate the compiled files for each language. The pages are created in build/html/<language>, so the adjustment needs to be made in Jenkins (I don't know how it works) and wherever the html folder path is used.
  • To test the multilanguage feature, just follow these three steps:
    1. Generate the .pot files with make gettext
    2. Generate the .po files for each language with make update po LANG=<language>
    3. Generate the HTML files with make html LANG=<language>

Note: Currently, the make multiversion command doesn't work in different languages because it takes files from the ROS branches (rolling, iron, etc.). But once the change is uploaded to the rolling branch and backported, all branches will load the translations. If you want to test multiversion, you need to add the multilanguage branch to smv_branch_whitelist and add multiversion to the distro_full_names dictionary in the conf.py file.

cychitivav avatar Aug 19 '23 14:08 cychitivav

This pull request has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/translation-of-ros-industrial-training/33239/1

ros-discourse avatar Sep 05 '23 08:09 ros-discourse