Translation
For more information, please refer to
- https://github.com/google/comprehensive-rust/blob/main/TRANSLATIONS.md
- https://github.com/google/mdbook-i18n-helpers
Prerequests
- Install gnu gettext
- Install mdbook:
cargo install mdbook - Install mdbook-mermaid:
cargo install mdbook-mermaid - Install mdbook-i18n-helpers:
cargo install mdbook-i18n-helpers
Init
-
init po
just book_init xx -
add language select button
file: ./book/theme/index.hbs
<ul id="language-list" class="theme-popup" aria-label="Languages" role="menu"> <li role="none"><button role="menuitem" class="theme"><a id="en">English</a></button></li> + <li role="none"><button role="menuitem" class="theme"><a id="xx">Some Language</a></button></li> </ul> -
update github action
file: .github/workflows/gh-pages.yaml
env: CARGO_TERM_COLOR: always # Update the language picker in index.hbs to link new languages. - LANGUAGES: zh + LANGUAGES: zh xx
Build
just book_build xx
Serve
just book_serve xx
Update po
just book_update xx
Serve all languages
-
build all languages
just book_build_all -
you may need a http server like TheWaWaR/simple-http-server
simple-http-server -- ./book/book