Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Localization of PRQL Language Book #5664

hwhsu1231 started this conversation in Show and tell
Discussion options

Announcement

Hello, PRQL Community,

I’m glad to announce that the 🎉 prql-book-l10n 🎉 project is published now:

The goal of this project is to translate the PRQL Language Book into multiple languages. Translations are contributed via the Crowdin platform, automatically synchronized with the GitHub repository, and can be previewed on GitHub Pages.

How to Contribute Translations

To contribute the translations, just follow the following steps:

  1. Create an account on Crowdin Enterprise if you don't have one.
  2. Log in and go the prql-book-l10n project.
  3. Choose the language you would like to contribute.

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.

How to Keep Translations Up-to-date

An FAQ that is sure to come up in the PRQL community is: How to keep translations up-to-date?

First and foremost, in my opinion, the focus should be on how to keep the "Translatable Content (msgid)" up-to-date, rather than the "Translations (msgstr)". I will explain the most critical part of the whole infrastructure here.

In short, the ci-mdbook-update-pot.yml workflow will be executed weekly to check the upstream project for any required updates to the document content, which in turn triggers the update of the .pot files. If an update is needed, a Pull Request (PR) is automatically created to merge into the l10n branch. For example:

Once those PRs are merged, the ci-gettext-update-po.yml workflow will be triggered to merge the updated content from the .pot files into the .po files for each language. This is essentially how @localizethedocs keeps the "Translatable Content" up-to-date.

Therefore, the core responsibility of the code maintainers, besides ensuring the stable operation of the scripts and workflows, is to regularly check whether there are any pending PRs that need to be merged.

How to Reuse Translations

If the upstream project or anyone wants to reuse the translated .po files prepared by the prql-book-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/prql-book-l10n.git locale

Those po/${VERSION} branches are created to facilitate reusage by the upstream project. For instance, the zh_TW documentation for the 0.12 version can be generated using the commands below:

TAG=0.12.2
VERSION=0.12
LANGUAGE=zh_TW
RENDERER=html
# Prepare the repository and environment
git clone --branch=${TAG} --depth=1 https://github.com/PRQL/prql.git prql-book
cd prql-book
conda create --prefix ./.conda --yes
conda activate ./.conda
conda install \
 conda-forge::rust=1.91 \
 conda-forge::dasel=2 \
 conda-forge::jq \
 --channel conda-forge \
 --yes
export CARGO_INSTALL_ROOT=$(pwd)/.conda
cargo install \
 mdbook@^0.4 \
 mdbook-i18n-helpers@^0.3 \
 mdbook-admonish@^1.20 \
 mdbook-footnote@^0.1
# Clone the .po files to the 'locale' directory
git clone --branch=po/${VERSION} --depth=1 https://github.com/localizethedocs/prql-book-l10n.git web/book/locale
# Build and Preview the documentation
export MDBOOK_BOOK__LANGUAGE=${LANGUAGE}
export MDBOOK_OUTPUT="{\"$RENDERER\":$(dasel -f web/book/book.toml "output.$RENDERER" -w json)}"
export MDBOOK_PREPROCESSOR__GETTEXT=$(jq -n -c '{"after":["links"],"po-dir":"locale"}')
mdbook build web/book --dest-dir $(pwd)/${RENDERER}/${LANGUAGE}
firefox $(pwd)/${RENDERER}/${LANGUAGE}/index.html

Related Dicussions

There is an existing dicussion proposing translations for the PRQL Language Book in the Discord Server:

And, I believe this prql-book-l10n project should be able to fulfill this requirement.

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /