Skip to content
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

Use gettext based translations #171

Open
Nutomic opened this issue Apr 20, 2023 · 2 comments
Open

Use gettext based translations #171

Nutomic opened this issue Apr 20, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@Nutomic
Copy link
Member

Nutomic commented Apr 20, 2023

That way translations could be done via weblate which should be much easier for contributors. Its also a good opportunity to finally upgrade our mdbook version.

https://crates.io/crates/mdbook-i18n-helpers

@Nutomic Nutomic added the enhancement New feature or request label Apr 20, 2023
@Nutomic
Copy link
Member Author

Nutomic commented Apr 27, 2023

Gave this a try but this is not quite ready to use yet. The helper only allows building the book for a single language at a time, and doesnt include a language selector. So we should wait until those things are added before migrating.

google/mdbook-i18n-helpers#12

google/mdbook-i18n-helpers#13

@mgeisler
Copy link

Hi all, thanks for trying out mdbook-i18n-helpers!

The helper only allows building the book for a single language at a time,

This is a bit of a feature — instead of trying to hack on mdbook to teach it about the translations, we simply generate the translations one-by-one. We have ~18 translations for Comprehensive Rust 🦀 and this system works quite well for us.

One advantage of this: it's clear that the built-in mdbook search functionality is per-language. If I had somehow added all the translated Markdown files into a single src/ folder, then I would have had to do something to avoid having the search index cover all languages simultaneously 🙂

and doesnt include a language selector. So we should wait until those things are added before migrating.

You're right and I would like to package up a language selector! However, for now, we simply edit the theme/index.hbs as needed. Out of the 18 translations, only two are at a stage where we link them directly in the language selector (see the globe in the top-right of any published page).

Please open issues for any problems you run into if you try it out again. It's important for me that the plugins work in general and not just in my own special case 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants