-
Notifications
You must be signed in to change notification settings - Fork 411
Description
Announcement
Hello, Rust Unofficial Community,
I’m glad to announce that the 🎉 rust-patterns-l10n 🎉 project is published now:
- 🚀 Preview: rust-patterns-l10n
- 🌐 Crowdin: rust-patterns-l10n
- 🐙 GitHub: rust-patterns-l10n
The goal of this project is to translate the Rust Design Patterns into multiple languages. Translations are contributed via the Crowdin platform, automatically synchronized with the GitHub repository, and can be previewed on GitHub Pages.
If translators want to translate a language that is not yet supported, they just need to open a new issue to request the new language. Once the requested language is added, they can begin translating.
Although the upstream project already prepares .pot and .po files in the po directory, it seems that this part of the project appears to be stagnant, and the translation workflows have been commented out. Besides IMO, frequent translation updates make the commit history too noisy. Therefore, I'd recommend keeping the upstream repository for English only and moving all .po files to a separate repository. This rust-patterns-l10n project was designed specifically for this purpose.
How to Reuse Translations?
If the upstream project or anyone wants to reuse the translated .po files prepared by the rust-patterns-l10n project, they can clone the .po files from the po/${VERSION} branch by using the following command:
git clone --depth=1 --branch=po/${VERSION} https://github.com/localizethedocs/rust-patterns-l10n.git localeThose po/${VERSION} branches are created to facilitate reusage by the upstream project. For instance, the zh_TW documentation for the latest version can be generated using the commands below:
BRANCH=main
VERSION=main
LANGUAGE=zh_TW
RENDERER=html
# Prepare the repository and environment
git clone --branch=${BRANCH} --depth=1 https://github.com/rust-unofficial/patterns.git rust-patterns
cd rust-patterns
conda create --prefix ./.conda --yes
conda activate ./.conda
conda install conda-forge::rust=1.90 conda-forge::dasel=2 conda-forge::jq --channel conda-forge --yes
export CARGO_INSTALL_ROOT=$(pwd)/.conda
cargo install mdbook@^0.5 mdbook-i18n-helpers@^0.4 mdbook-last-changed@^0.4
# Clone the .po files to the 'locale' directory
git clone --branch=po/${VERSION} --depth=1 https://github.com/localizethedocs/rust-patterns-l10n.git locale
# Build the documentation
export MDBOOK_BOOK__LANGUAGE=${LANGUAGE}
export MDBOOK_OUTPUT="{\"$RENDERER\":$(dasel -f book.toml "output.$RENDERER" -w json)}"
export MDBOOK_PREPROCESSOR__GETTEXT=$(jq -n -c '{"after":["links"],"po-dir":"locale"}')
mdbook build . --dest-dir $(pwd)/book/${LANGUAGE}
# Preview the documentation
firefox $(pwd)/book/${LANGUAGE}/index.html