flutter_rust_bridge
flutter_rust_bridge copied to clipboard
Add i18n support
Add gettext and i18n support
This is still a draft now, I want to discuss some questions here. I have tried to use code from https://github.com/rust-lang/mdBook/pull/1864 and https://github.com/rust-lang/mdBook/pull/1306, and found a bug there. It was fixed quickly. This translation process is feasible, but both of them are not merged yet, so configuring the environment is a little complicated.
Hi! Thanks for opening this pull request! :smile:
This is still a draft now
Done
This translation process is feasible, but both of them are not merged yet, so configuring the environment is a little complicated.
Hmm good question. Is it possible that, you firstly configure everything under your fork?
@all-contributors please add @trdthg for doc
Is it possible that, you firstly configure everything under your fork?
Yes, It's not really that complicated, except that you have to clone two other copies of the mdBook. And then config them here.
# [Add commands for Gettext-based translations i18n #1864](https://github.com/rust-lang/mdBook/pull/1864)
# extract and generate pot/po file
MDBOOK1="path to #1864 mdbook"
# [Add option to localize books in multiple languages #1306](https://github.com/rust-lang/mdBook/pull/1306)
# add multi-language support
MDBOOK2="path to #1306 mdbook"
Great!
Btw is the translatetool written by you? Maybe we can merge it into justfile
, which has excellent support for commands, so no need for checkArgNumber etc
Btw is the translatetool written by you?
Yes.
Maybe we can merge it into justfile,
Good idea. You may do some more detailed check.
Here is the current progress.
I moved scripts to justfile
and update CI workflow. After the rust 1.64 update, pr 1306 is broken, so I folked and fixed that problem. Now just
and CI works.
But I don't really like this solution, and I found https://github.com/rust-lang/mdBook/issues/5#issuecomment-1258922986 today, which seems to be better. Should I switch?
But I don't really like this solution, and I found https://github.com/rust-lang/mdBook/issues/5#issuecomment-1258922986 today, which seems to be better. Should I switch?
Depend on you. When doing https://github.com/fzyzcjy/flutter_smooth, I tried http://cjycode.com/flutter_smooth/, which uses https://docusaurus.io/. That one seems to have excellent multi-lang support.
So you can even switch the whole book to docusaurus as well :)
Looks good, I'll give it a try.
Btw @Desdaemon what do you think about the doc site? (Since you have written several chapters)
Btw @Desdaemon what do you think about the doc site? (Since you have written several chapters)
It looks great! I might contribute some translations myself if it works out well.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
👀
eyes
Busy with other things, but maybe next week will be free to continue 😵
take your time!
Hi @trdthg, I found this PR linked from https://github.com/rust-lang/mdBook/issues/5 :smile:
I see you've been using the code I wrote in https://github.com/rust-lang/mdBook/pull/1864 — I just wanted to let you know that I've updated the code to be much easier to use. You no longer need to modify mdbook itself, you just use a preprocessor (to translate) and a renderer (to extract strings). Please see https://github.com/google/comprehensive-rust/pull/130.
Feel free to drop me a comment on that PR if you try it out!
👀
The code in question is now released as a stand-alone crate: https://crates.io/crates/mdbook-i18n-helpers. This should let you simplify the PR here a great deal :smile:
@mgeisler, Thanks for the reminder, hope my reply is not too late
Comprehensive-rust
already made a good example, my solution (with modified mdbook-i18n-helpers
+ mdbook-i18n
) seems to add extra complexity.
@fzyzcjy I think we can use the same way as it, what do you think?
@trdthg You are feel to use any method that is simple and easy to maintain :)
@mgeisler Both deleted
So, I briefly checked it: https://trdthg.github.io/flutter_rust_bridge/zh/quickstart.html The "zh" mode still only contains English. Maybe I am checking the wrong location?
The "zh" mode still only contains English.
@fzyzcjy Yes, I only translate "Introduce" in sidebar to "介绍" for now. More translations will be added gradually in other PRs.
I see. So this PR adds the necessary code instead of translation content if I understand correctly.
Seems the CI fails. Could you please check it a bit?
Good job! I will check soon, probably within 24 hours (since quite busy recently)
Firstly, seems that this is not deployed successfully?
Btw, it seems the zh homepage is somehow broken:
Btw, it seems the zh homepage is somehow broken:
@fzyzcjy seems the reason comes from mdbook-i18n-helper, after I install it from source, then build and serve locally. it's fixed
@mgeisler I saw that compensive-rust also has this little problem, maybe you need to release a new version?