-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Add translation support #3950
base: main
Are you sure you want to change the base?
Add translation support #3950
Conversation
TRANSLATING.md
Outdated
|
||
### Preparation | ||
|
||
RBE uses [mdbook-i18n-helpers](https://github.com/google/mdbook-i18n-helpers) as a translation framework. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"RBE" is probably referring to "Rust by Example"? It should be updated here 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I've fixed it.
theme/index.hbs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If adding a copy of the theme is seen as too cumbersome, an alternative approach would be to use a bit of JavaScript to inject the language picker. That might be nicer for long-term maintenance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative approach seems to be better.
Is there an actual example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I haven't used this approach myself since I wanted to modify the theme file anyway and so it was easier to hard-code the language picker there.
Thanks @dalance for creating this PR! I would be very happy to see the translation system used here too! |
5ecf38d
to
f5cebc3
Compare
f5cebc3
to
27740af
Compare
@chriskrycho |
@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! |
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. |
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. |
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. By the way, I have another idea to reduce cost to approve translation PR by using auto-merging mechanism of GitHub.
[{
"lang": "ja",
"file": "po/ja.po",
"owner": "rust-lang-ja"
}]
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. |
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 I have not yet written such a bot, but it would be a fun project. |
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 rust-lang/rust#124731, so I think this framework became ready for introducing into this book.
Refs: #464