Skip to content

Instantly share code, notes, and snippets.

@cfm
Last active March 18, 2022 02:08
Show Gist options
  • Save cfm/d3173206f55d7e44152928fcfd215031 to your computer and use it in GitHub Desktop.
Save cfm/d3173206f55d7e44152928fcfd215031 to your computer and use it in GitHub Desktop.

How to think about translation workflows: a refresher

Any translation workflow we adopt must implement the following stages:

  1. extraction of source strings from Python code (securedrop_client/**/*.py) to the catalog template (securedrop/locale/messages.pot);
  2. merging of the source strings from the template into each locale's translation catalog (securedrop/locale/*/LC_MESSAGES/messages.po); and
  3. compilation of each locale's translation catalog from portable-object format (.po) to the machine-object format (.mo) loaded at runtime.

The following table summarizes the approaches we've considered to date:

Step/Workflow reference current securedrop-client option A securedrop-client option B
Implemented in securedrop securedrop-client#1282 securedrop-client#1347 securedrop-client#1348
(1) extract .py.pot manual via i18n_tool.py during release CI against main pre-commit hook (enforced by CI) pre-commit hook (enforced by CI)
(2) merge .pot.po manual via i18n_tool.py during release CI against main pre-commit hook (enforced by CI) Weblate add-on
(3) compile .po.mo builder playbook via i18n_tool.py during release setup.py sdist (or run.sh) setup.py sdist (or run.sh) Weblate add-on

We should adopt option A if:

  1. We want developers to be able to test locally changes that might affect steps (2) and (3) as well as step (1), without requiring these changes to go through Weblate.

We should adopt option B if:

  1. We want developers' string changes to appear in their commits only in the catalog template, not also in each locale's translation catalog.
  2. We want Weblate to run as much of our Weblate workflow as possible, rather than using custom code and tooling.
  3. We want to remove localization-related dependencies from securedrop-debian-packaging (securedrop-debian-packaging#270).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment