Readthedocs.org: How to support another language

Created on 30 Jun 2018  路  25Comments  路  Source: readthedocs/readthedocs.org

Details

my po files are in the https://github.com/faneshion/MatchZoo/tree/feature/multi-lang-support/docs/source/locale/zh/LC_MESSAGES
and https://github.com/faneshion/MatchZoo/tree/feature/multi-lang-support/docs/source/locale/en/LC_MESSAGES
**build_url: https://readthedocs.org/projects/matchzoo/builds/7421530/

Expected Result

multi-language-doc

Actual Result

It seems that RTD can not detect my po files ,so what should i do? I want the detailed help.

Support

Most helpful comment

I just saw you are already building your docs in another language https://matchzoo.readthedocs.io/zh_CN/2.0/ If your question is how to build your docs in en too. Well, you need to create another rtd project (say matchzoo-en) and change the language to en there. Then you can link the projects as mention in https://docs.readthedocs.io/en/latest/localization.html#project-with-multiple-translations. Admin -> Translations, this way you will have matchzoo/en and matchzoo/zh_CN

All 25 comments

I saw it ,but i still dont know what is wrong with my project @stsewd i have my po files

Could you please give me a detailed guide like getting-started

I have never used that option, I'll try to build this locally and see if we still support this kind of docs (with PO files).

I just saw you are already building your docs in another language https://matchzoo.readthedocs.io/zh_CN/2.0/ If your question is how to build your docs in en too. Well, you need to create another rtd project (say matchzoo-en) and change the language to en there. Then you can link the projects as mention in https://docs.readthedocs.io/en/latest/localization.html#project-with-multiple-translations. Admin -> Translations, this way you will have matchzoo/en and matchzoo/zh_CN

Thank you for your help. I know the common progress--using the rst and conf to generate docs and how to select the build language. That is not my goal. There are two things still make me confused. The first one is that what does the po files do in this progress as you mentioned that You must commit the .po files for Read the Docs to translate your documentation.
And the other one is that i saw the example phpadmin you mentioned in the guide. https://github.com/phpmyadmin/localized_docs
They setup only one project to support multi-language doc. All the po files are in the po dir, all the pot files are in the locale dir, maybe i can use this way to manager my multi-language docs. So what should i do for this aim? @stsewd

In another words , i want generate docs from po files

@wqh17101 they have one repository with all po files, but many read the docs project for each translation.

https://readthedocs.org/projects/phpmyadmin-japanese/
https://readthedocs.org/projects/phpmyadmin-spanish/
https://readthedocs.org/projects/phpmyadmin-czech/

So, what you need to do is create one rtd project for each translation (each one pointing to the same repo), then choose their language and link all as translations of the main rtd project (Admin -> Translations)

How to use the po files? I have many po files now @stsewd

I don't understand, you need to put them as you have inside the locale directory and then select the language in the rtd admin panel.

https://github.com/faneshion/MatchZoo/blob/feature/multi-lang-support/docs/source/locale/zh/LC_MESSAGES/index.po
look at this one,
image
i add the msgstring in Chinese and i select the language Chinese and get a result
https://matchzoo.readthedocs.io/zh/feature-multi-lang-support/#
It doesn't work. the title is still in English @stsewd

I think you need to regenerate the mo files too

Ok i will try.

How to regenerate the mo files? i run sphinx-intl build it doesn't work. @stsewd

It works now. i can build the doc by different po files. But i also want to know how to create one rtd project for each translation (each one pointing to the same repo). My base repo is Matchzoo.
image
i can only import it once. So ,how can i create other rtd projects.Should i create many repos which add submodule my base repo and then import them and set them as the translation of my base repo @stsewd

You need to do a manual import for the rest of the repos https://readthedocs.org/dashboard/import/manual/ and configure the webhook manually https://docs.readthedocs.io/en/latest/webhooks.html#webhook-creation

You mean i must create many repos for translation? @stsewd

Yes

Closing this, as isn't a read the docs problem. Please feel free to make suggestions for the documentation if you think so!

I think if you can support that generating docs from different directories start with docs in one repo,such as docs_en docs_zh, it will be better. These dirs have the same structure as the one used now. @stsewd

I'm not sure if I understand this. You say to be able to build multiple translations within the same project? That would be a feature request, if so. Can you please open a new issue with that details? So the core team can analyze the use case

GOT IT

Just dropping in here to note that you do not need to create multiple repositories to support multiple languages. You can set each translation project's conf.py path separately in the project admin dashboard. We don't have a good pattern for this that strictly uses our yaml config though. Ideally, we should just automate setting the conf.py language so that no different conf.py is needed at all though.

https://github.com/faneshion/MatchZoo/blob/feature/multi-lang-support/docs/source/locale/zh/LC_MESSAGES/index.po
look at this one,
image
i add the msgstring in Chinese and i select the language Chinese and get a result
https://matchzoo.readthedocs.io/zh/feature-multi-lang-support/#
It doesn't work. the title is still in English @stsewd

Hi, I'm stuck at the same issue and nothing shows up in translated language even though .po files are present. How did u regenerate the .mo files? Did u commit them along w/ .po files.

I think you need to regenerate the mo files too

How to do this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidism picture davidism  路  4Comments

humitos picture humitos  路  4Comments

enielse picture enielse  路  4Comments

boscorelly picture boscorelly  路  4Comments

gtalarico picture gtalarico  路  4Comments