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

what is the most efficient way to support translation ? #9903

Open
12rambau opened this issue Jan 16, 2023 · 9 comments · May be fixed by #10581
Open

what is the most efficient way to support translation ? #9903

12rambau opened this issue Jan 16, 2023 · 9 comments · May be fixed by #10581
Labels
Needed: documentation Documentation is required

Comments

@12rambau
Copy link

context

This is not a bug per se, I think it's more a documentation request, as I have all the difficulties in the world understanding how to support parralel build of the same documentation in multiple languages. What I would like to do here is write down what I understood, wait for your answers, and when it will work propose some updates to the RDT documentation.

Note that I come here after reading:

The behavior I would like to reproduce is the one from the Sphinx documentation itself.

step 1 prepare the repository

For the sake of example I created a pet project here: https://github.com/12rambau/docs. The documentation is hosted here: https://docs-test-pierrick.readthedocs.io/en/latest/.

First I prepared the appropiate files using sphinx and sphinx-intl:

sphinx-build -b gettext

To generate the .pot files

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

To create the .po files in /locale.
In these translation files, I added the translations in french and tested the documentation by changing the language parameter in my conf.py file. At the moment everything is sent to my distant repo but some cleaning will be necessary once I better understand what is regenerated on the fly.

step 2: deploy on RDT

Now is the real deal, how to activate these different versions in RDT. I would like to make it as automatic as possible so that when I updated stuff on transifex/crowdin I don't have 7 RDT projects to update and check.

What I think I should do is:

  • create 1 extra project per language
  • register them in the translation section of my "master" project

My question are then:

  • How can I set the language to build without setting multiple conf.py (I checked sphinx there is only one)?
  • Can I create multiple projects from the same repository ?
  • Is there a trick to autodetect the available languages with some parameters in .readthedocs.yaml or simply by setting locale_dirs in my conf.py ?
@stsewd stsewd added the Support Support question label Jan 19, 2023
@stsewd
Copy link
Member

stsewd commented Jan 19, 2023

@12rambau, as mentioned in https://docs.readthedocs.io/en/stable/localization.html#project-with-multiple-translations you need to create one RTD project per translation and add them as translations of your main project.

How can I set the language to build without setting multiple conf.py (I checked sphinx there is only one)?
Can I create multiple projects from the same repository ?

When importing a project, in the advanced settings you can choose the language of that project, that would be used when running sphinx on rtd, i.e sphinx-build -D language=es_AR.

Can I create multiple projects from the same repository ?

Yes, but you need to import them manually, this is from https://readthedocs.org/dashboard/import/manual/. I think the integration (webhooks to trigger a new build on each commit) should be created automatically, but if not, you can follow this guide https://docs.readthedocs.io/en/stable/integrations.html.

Is there a trick to autodetect the available languages with some parameters in .readthedocs.yaml or simply by setting locale_dirs in my conf.py ?

locale_dirs should be enough.

@12rambau
Copy link
Author

I managed to make it work, Thanks for your help. I'll propose an edit of the doc accordingly.

@stsewd
Copy link
Member

stsewd commented Jan 19, 2023

I'll propose an edit of the doc accordingly.

That would be great, thank you!

@stsewd stsewd added the Needed: documentation Documentation is required label Jan 19, 2023
@humitos humitos closed this as completed Jan 31, 2023
@12rambau
Copy link
Author

sorry for not updating anything, I didn't find the time

@stsewd
Copy link
Member

stsewd commented Jan 31, 2023

@humitos I don't think this has been resolved yet, we still need to update our documentation

@stsewd stsewd reopened this Jan 31, 2023
@stsewd stsewd removed the Support Support question label Jan 31, 2023
@humitos
Copy link
Member

humitos commented Jan 31, 2023

What are parts of the documentation we have to update? What's the content we need to add/change/delete?

@12rambau
Copy link
Author

now that I know this seems clear: https://docs.readthedocs.io/en/stable/localization.html#project-with-multiple-translations but it wasn't when I arrived so I think it can be refreshed so that new devs like me stop opening issues related to translating a project under the same url

@humitos
Copy link
Member

humitos commented Jul 24, 2023

@12rambau would you like to update that page to reflect your findings?

@12rambau
Copy link
Author

thanks for reposting it it was a the depth of my notification dashboard. I'll try to gather everything this WE

@12rambau 12rambau linked a pull request Jul 29, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needed: documentation Documentation is required
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants