Babel includes a command-line interface for working with message catalogs, similar to the various GNU gettext tools commonly available on Linux/Unix systems.
Weblate is a centralized plateform for translations. A RERO project exists.
We're using weblate as a web service to help the translation process, through the hosted service of weblate: https://hosted.weblate.org/projects/rero_plus
For our needs, on Weblate, we have one project (named RERO+, with rero_plus
as slug), with several components:
ng-core
.rero-ils
.rero-ils-public-search
(from the project rero-ils-ui
).rero-ils-admin
(from the project rero-ils-ui
).sonar
.sonar-ui
.With this workflow, developers only need to add translation markers in the source code's translatable strings, or, when necessary, add string in the manual translation file.
Testing the extraction to check the code is a good idea, though. But no files should be modified in the translation folders and subfolders (ie rero_ils/translations
or projects/admin/src/assets/rero-ils-ui/admin/i18n
).
We do not use the automatic workflow through the GitHub webhook, to avoid conflicts.
Weblate Github (translations
)
When translations have been updated on Weblate, we commit and push them to the Github translations
branch. This is generally done before extracting new messages or right before a release but can be done at anytime during the sprint
Manage
, Repository Maintenance
: Commit
all changes and Push
.translations
branch. Rebase and merge
this PR.Weblate Github (translations
) Github (staging
)
when all PRs from a Release-Candidate have been merged into staging
, we need to extract the messages and push them to Weblate so that they can be translated.
upstream/translations
(see push translations).translations
branch and pull the changes from upstream/translations
.git pull --rebase upstream staging
.translations
, extract the messages and check that everything looks good.
npm ci
to compile the project, npm run extract_messages
to extract the strings from the code to the master messages file.poetry run python ./setup.py extract_messages
to extract the strings from the code to the master messages file.npm run update_catalog
poetry run python ./setup.py update_catalog
translations: extract messages
.translations
branch to upstream with git push upstream translations
.Weblate Github (translations
) Github (staging
)
When the translators have finished working on the release, we can push the changes from Weblate to translations
, then to staging
.
upstream/translations
(see push translations).staging
is up to date with upstream/staging
.translations
branch and pull the changes from upstream/translations
.translations
branch onto staging
: git rebase staging
.git rebase -i HEAD~4
(4 being the number of commits to sqash). See this section for details.staging
and git rebase translations
.git push upstream staging
). If you want reviews, create a PR from the translations
branch on the staging
branch and merge it when validated.translations
branch to upstream:translations
so that staging
and translations are at the same commit.Maintenance
-> Reset
to force-sync Weblate and Github.Weblate creates one commit per language when pushing changes. In order to limit the number of commits created by Weblate in the repositories, translation commits are sqashed into one before being pushed back to upstream/translations
. To simplify this process, the commit message should look like the following template:
translations: translate vX.X.X
Translate-URL: https://hosted.weblate.org/projects/rero_plus/rero-ils/
# Adapt this link to the component
Co-Authored-by: Nicolas Prongué <n.prongue@outlook.com>
Co-Authored-by: Pascal Repond <pascal.repond@rero.ch>
# If needed, add all contributors that specifically participated to this particular commit (optional)
en_US
as the source language file, in order to avoid translating it.^(?!(en_US)$).+$
(for ng-core
, public-search
, admin
). This is needed, as in our angular project, the source language file is the same as a translated language files.^(?!(messages)$).+$
(for sonar-ui
). The same as the precedent setting, but adapted to the sonar-ui
configuration.wlc
client.