Open Fomalhauthmj opened 2 years ago
As long as mdbook doesn't support i18n we should probably create a new sections for 'translations' in SUMMARY.md
and collect them there.
@Fomalhauthmj I think can just use the usual approach when i18n is not support, put the translated link in README. Let me submit a pull request for this.
Reopening: We are refactoring to a new translation system that should make it easier.
CC: #352 #345
@Fomalhauthmj Would you be able to adopt your translation when we are ready?
Of course, I will review my translation again in the spare time for a better reading experience.
It will probably still take some time until we can fully adopt it, as it seems like that Markdown formatting isn't transferred in the translation process. Afaiu that could destroy the ability to further translate things within a language, when we would reformat the original markdown. So take you time, really.
Tracking: https://github.com/google/mdbook-i18n-helpers/issues/19
The translation system is merged π and translations are now supported in this repository.
Please read here how translations can be updated/added. If any further help is needed setting it up, please tag me.
Ok, I have learned how to work with po files.When my translation being prepared, I will open a pr on main branch.
Ok, I have learned how to work with po files.When my translation being prepared, I will open a pr on main branch.
I prepared some CI stuff already, so when your PR comes, we need to set it up for a first translation. It shouldn't be a lot of work, but please make sure maintainers can edit your branch
so we can help setting up the very first translation. ππ½
I'm working on a German translation in #359 so I will make the initial setup there. Within your PR for another language, we would only need to add stuff to the language picker and CI manually. ππ½
@simonsan , I found that messages.pot
file doesn't contain corresponding quote links, check this file, the following contents can't found in messages.pot
.
[associated function]: https://doc.rust-lang.org/stable/book/ch05-03-method-syntax.html#associated-functions
[std-default]: https://doc.rust-lang.org/stable/std/default/trait.Default.html
[std-or-default]: https://doc.rust-lang.org/stable/std/?search=or_default
[API Guidelines/C-COMMON-TRAITS]: https://rust-lang.github.io/api-guidelines/interoperability.html#types-eagerly-implement-common-traits-c-common-traits
Need to investigate that the next days. Thanks for bringing it up. It could be also related to markdown formatting in https://github.com/google/mdbook-i18n-helpers/issues/19 so will also double check if that could be an upstream issue as well
I have checked the process of create_catalog
in mdbook-i18n-helpers, use following test function:
fn my_test() -> anyhow::Result<()> {
let (ctx, _tmp) = create_render_context(&[
("book.toml", "[book]"),
("src/SUMMARY.md", "- [The Foo Chapter](foo.md)"),
(
"src/foo.md",
"this is a quota link [name1][ref1].\n\n[ref1]:test_url\n",
),
])?;
let catalog = create_catalog(&ctx)?;
for msg in catalog.messages() {
assert!(!msg.is_translated());
}
Ok(())
}
AndοΌthe events we got are:
Start(Paragraph) -- "this is a quota link [name1][ref1].\n"
Text(Borrowed("this is a quota link ")) -- "this is a quota link "
Start(Link(Reference, Borrowed("test_url"), Borrowed(""))) -- "[name1][ref1]"
Text(Borrowed("name1")) -- "name1"
End(Link(Reference, Borrowed("test_url"), Borrowed(""))) -- "[name1][ref1]"
Text(Borrowed(".")) -- "."
End(Paragraph) -- "this is a quota link [name1][ref1].\n"
It seems like that we need make sure that [ref1]
shouldn't be translated for correct reference-style links. In this way, the reference-style links can work fine as usual.
In last two weeks, I read this book and did my best to translate it into a newer simplified Chinese translation. Maybe we can add a translation list in readme for those who want read in native language?.π€ The translation repo is here .