Multilanguage support and GitHub Actions
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:
This process can be somewhat simplified with the help of the sphinx-intl library:
- Upload
.rstfiles with the documentation in English. - Generate a
.potfile from the.rstfiles usingmake gettext(these files would be stored in thebuildfolder). - Update the
.pofiles with the.potfiles usingsphinx-intl update -p build/locale -l <language>. - Translate the
.pofiles manually or with the assistance of a translator. - Build the documentation in the desired language using
make -e SPHINXOPTS="-D language='<language>'" html(the output would be stored in thebuild/<language>folder).
File handling is better described in #3678, but I am still willing to answer questions or concerns in this PR.
I have finished the configurations. Now I just have a few considerations:
- Running the commands
make multiversionandmake htmlremains the same. I only added a new variableLANGto 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:
- Generate the
.potfiles withmake gettext - Generate the
.pofiles for each language withmake update po LANG=<language> - Generate the HTML files with
make html LANG=<language>
- Generate the
Note: Currently, the
make multiversioncommand 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 themultilanguagebranch tosmv_branch_whitelistand addmultiversionto thedistro_full_namesdictionary in theconf.pyfile.
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