-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Multi-language support and management #3678
Comments
First, I'm sorry for the very long delay in responding. Second, I agree with you that for the most part, it would be much better if the translations lived in the same repository as the original English documentation. Otherwise, it is going to get out of sync quickly and be hard to keep up-to-date. However, I do have concerns that it will be hard for the current maintainers of With all of that said, I would love to see a PR that has the changes to make this happen. We can discuss more about what this would look like there. Note that the way we build official documentation does not use a GitHub action, but instead invokes the Dockefile at https://github.com/ros2/ros2_documentation/blob/rolling/docker/image/Dockerfile, so any solution will need to be integrated there. |
Hi, Thank you very much for your feedback. Of course, I have created the Pull Request (#3829). For now, I'll keep it as a draft while I make some changes, as the version I had is outdated. Regarding GitHub Actions, I only use it to update the PO files, and the only change in Docker is adding the sphinx-intl package to the requirements.txt file. |
thank you very much detailed explanation! i would like to ask a couple of questions,
this sounds that mainline doc easily breaks multiple language docs? this works for mainline doc maintainers, but can be problems for multiple language doc maintainers? i am not so familiar with |
Hi @fujitatomoya, I had forgotten to mention that these .po files are not only for Sphinx; they are actually used in various internationalization cases as they separate the code or formatting from the translation. I bring this up because these files can be managed using several tools, and one of them is the Regarding synchronization, I've been working on a GitHub Actions workflow to perform updates and generate a report every time a commit is made in the source folder. However, I think it's not ideal and warrants discussion. Lastly, when a I hope this solves your concerns and don't forget to mention something. |
hi @cychitivav I strongly agree with your points about the importance of having multi-language tutorials support. There is any update subject? |
Hello,
I am a member of the Spanish ROS community, and I have been reading issue #3249. I believe that translating into multiple languages is crucial because, at one point, I was one of those individuals who struggled to learn ROS due to the language barrier in the documentation.
Apart from the steep learning curve of ROS, the fact that the documentation is only available in English makes the learning curve even steeper. Therefore, I think it's essential to have the documentation available in multiple languages to enable more people to learn ROS.
Creating separate repositories for each language seems impractical since every update in the original repository creates conflicts when merging into individual language repositories. While exploring Sphinx's documentation on internationalization (https://www.sphinx-doc.org/en/master/usage/advanced/intl.html), I found the following approach:
Process
This process can be somewhat simplified with the help of the
sphinx-intl
library:.rst
files with the documentation in English..pot
file from the.rst
files usingmake gettext
(these files would be stored in thebuild
folder)..po
files with the.pot
files usingsphinx-intl update -p build/locale -l <language>
..po
files manually or with the assistance of a translator.make -e SPHINXOPTS="-D language='<language>'" html
(the output would be stored in thebuild/<language>
folder).Structure of
.po
filesThese files allow the translation of phrases or short paragraphs, where people with basic knowledge of English can perform the translation. Additionally, the authorship of each translation can be maintained, and changes made in each language can be tracked without affecting the English documentation (.rst files).
As described in the GNU documentation:
In essence, the
.po
files are a list of entries, each having amsgid
and amsgstr
. Themsgid
represents the original English text, and themsgstr
contains the translation.Management of .po files
I have been working on a fork of this repository (https://github.com/cychitivav/ros2_documentation/tree/multilingual) to automate the generation of
.po
files using GitHub Actions. With some changes in thesource
folder, it is possible to generate.po
files for multiple languages simultaneously.Furthermore, the action includes code to extract the current status of the
.po
files, providing information on the number of translated and untranslatedmsgid
entries. With this information, an issue could be automatically generated, or translations could be performed usinggoogletrans
(https://pypi.org/project/googletrans/) or similar tools.Modifications to msgid
An important aspect is to identify which files require translation and ensure that existing translations are not lost. To address this, I have explored the
sphinx-intl
module, which allows updating the.po
files based on the.pot
files generated bymake gettext
. During the update, the following scenarios can occur:New
msgid
entries are added: In this case, the.po
files are updated with the newmsgid
, and themsgstr
remains blank.A
msgid
entry is removed: In this case, the correspondingmsgid
is removed from the.po
file.A
msgid
entry is not modified: In this case, the correspondingmsgstr
is preserved.A
msgid
entry is modified: This last scenario includes the additional functionality ofmake gettext
, which uses a fuzzy comparison (Levenshtein distance) to determine the extent of the documentation changes.If the change is minimal, the
fuzzy
flag is added, allowing the previous translation to be temporarily preserved until it is updated (or published if desired). For example, if a comma is changed to a period:On the other hand, if the change is significant, the translation in the
.po
file will be removed, and the newmsgid
will be added:Handling for each language
I have made some changes to the makefile so that files for multiple languages can be generated simultaneously (according to the interested translation communities). Additionally, I have placed the
locale
folder in the root of the repository to avoid conflicts in the action workflow.The folder structure is as follows:
As you can see, the
locale
folder contains the.po
files, and thesource
folder remains unchanged to prevent any loops in the action or damage to the English documentation. As suggested by @fujitatomoya:Feasibility
Given the change tracking performed by
make gettext
andsphinx-intl
in the.rst
files, I believe it is possible to maintain the documentation in multiple languages within a single repository once a significant portion of the documentation has been translated. This would even allow for automatic translation and community contributions to improve the translations through PRs.This is because if a large portion of the files is translated (either manually or automatically),
minor changes in the
.rst
files can be handled by temporarily preserving the previous translation until it is updated (or published, if desired).Final Comments
First and foremost, I would like to hear the maintainer's opinion on adding the
.po
files and thelocale
folder to the main repository. This would involve reviewing each pull request by a moderator for each language or implementing a similar process. By doing so, the authorship of each translation can be maintained, and changes made in each language can be controlled without affecting the English documentation (.rst
files).If you believe this is possible, I would like to submit a PR to the repository and await a review. I can also provide further clarification on the entire process.
It would be interesting to have a section like this on the ROS page:
https://docs.readthedocs.io/en/stable/localization.html
Considerations
sitemap.xml
.doc8
.The text was updated successfully, but these errors were encountered: