book
book copied to clipboard
Add translation support
This PR adds translation support based on https://github.com/google/mdbook-i18n-helpers.
Translation support by mdbook-i18n-helpers is already used at rust-by-example, and translation build support on rust-lang/rust was merged at https://github.com/rust-lang/rust/pull/124731, so I think this framework became ready for introducing into this book.
Refs: #464
Thanks @dalance for creating this PR! I would be very happy to see the translation system used here too!
@chriskrycho How do you think about this PR? This may not be perfect solution, but it works fine at many projects including Rust By Example. If translation databases for each language are stored in this repository, migrating another solution is probably easy in future. Is there any concern which blocks this PR?
@dalance in all honesty I have not yet had a chance to dig into it—but I will do so this morning, and @carols10cents and I are chatting later today, so we’ll talk about the maintainability tradeoffs as well. It’s a significant change for how we have managed translations for this in the past (read: we haven’t; we have just linked to the community-maintained translations) and maintenance on the book repo is sporadic to say the least, so we’ll want to consider it carefully. That’s by no means a “no”, just flagging up what the status is!
Thank you for your interesting! I agree concern about maintainability. For reference, in Rust By Example, translators of each language community are responsible for the translation and the original author of English version doesn't involve the contents of translations.
Thank you for your interesting! I agree concern about maintainability. For reference, in Rust By Example, translators of each language community are responsible for the translation and the original author of English version doesn't involve the contents of translations.
Do the translators have push permission on the main RBE repository or do the translations live in other repositories? I'm not sure I want to give lots of people permissions to this repo.
Translators don't have push permission. Instead of it, the maintainer of RBE approves a PR updating translation database in spite of the content.
Translators don't have push permission. Instead of it, the maintainer of RBE approves a PR updating translation database in spite of the content.
So each change to each translation means there's a PR that I or @chriskrycho has to approve? That's a lot of work that I don't have time to keep up with. I would rather it worked like it does now, where each translation sends one PR adding a link to the repo where the translation is managed independently (and I even have trouble keeping up with those PRs!)
Actually, each translators create an organization of the language (e.g. rust-lang-ja), and coordinate the translations and review them. After it, a PR is sent to RBE repository. If you don't have enough time to approve them, I think a rule like "A PR of each language should be sent up to once a year" can be determined.
Could you perhaps add a new commit to this PR (that we can then remove) showing how to point to a translation?
I added a commit to add Japanese translation resource.
The translation resource is po/ja.po. As a sample, I translated the title and the first statement of the front page.
By the way, I have another idea to reduce cost to approve translation PR by using auto-merging mechanism of GitHub.
- Regist language entry and owner At the first, translators create an organization for translation, add a language entry like below, and send a PR to this repository. This PR requires review and approvement by the maintainer.
[{
"lang": "ja",
"file": "po/ja.po",
"owner": "rust-lang-ja"
}]
- Add/Modify language resource
After it, the organization sends a PR to add or modify the language resource
po/ja.po. By GitHub Actions, the PR is checked whether it contains language resource only and is sent from the language owner. If the chech is passed, GitHub Actions merge the PR automatically.
By this approach, the maintainer pay approving cost only once for each language, and the language owners can modify the translation frequently without approving cost.
I'm thinking another solution which introduces translation sub-repository to rust-lang/rust. If you are interesting in it, please refer https://internals.rust-lang.org/t/pre-rfc-translation-sub-repository-for-rust-docs/21666 .
I would rather it worked like it does now, where each translation sends one PR adding a link to the repo where the translation is managed independently (and I even have trouble keeping up with those PRs!)
Hi 👋 I wrote the i18n infrastructure being proposed here.
The question of being centralized or not is actually orthogonal to the use of mdbook-i18n-helpers — even if translators maintain their own independent repositories like today, they can still benefit from the tooling. The benefit: it makes it practical for them to update the English source text since the translation is kept next to the source text.
For Comprehensive Rust, we've given write access to about 50 translators by now. Yes, it's a bit scary, but I have only seen good things come or this until now 🙂
A compromise, as suggested by @dalance, would be to have someone trusted (perhaps a bot) approve PRs from well-known translation repositories. The person or bot only needs to check that the PR only touches a single xx.po file.
I have not yet written such a bot, but it would be a fun project.
I created a PR to add translation submodule to rust-lang/rust. If this PR is accepted, translation can be added without merging cost of the original maintainers.
https://github.com/rust-lang/rust/pull/133562
https://github.com/rust-lang/rust/pull/133562 was rejected. So I'll consider about auto-merging approach again.
I'll close this PR. This is because it seems to be better that managing translation resources at external repository considering merging cost. Now I'm woriking on https://rust-lang-translations.org/.