Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rework localization Make targets for PR-level use #1317

Closed
8 tasks done
Tracked by #239
cfm opened this issue Oct 20, 2021 · 1 comment · Fixed by #1348
Closed
8 tasks done
Tracked by #239

rework localization Make targets for PR-level use #1317

cfm opened this issue Oct 20, 2021 · 1 comment · Fixed by #1348
Assignees
Labels

Comments

@cfm
Copy link
Member

cfm commented Oct 20, 2021

Context

In #1282 we implemented:

  1. a Make target update-translation-catalogs to extract source strings from securedrop_client/**/*.py for Weblate to make available to translators; and
  2. a GitHub Actions workflow l10n to make this target nightly on main.

In freedomofpress/infrastructure#3593 we have since concluded that this workflow requires that our @weblate-fpf bot push directly to main, which we are not willing to allow.

Goal

After discussing a number of alternatives, we have decided to adapt #1282's Make targets to be used interactively by developers (and perhaps in a Git pre-commit hook) and then enforced linter-style in CI.

In addition to removing the requirement that @weblate-fpf be able to push directly to main, this approach has two new advantages:

  1. Changes in the message catalog (securedrop_client/locale/messages.pot) will be recorded in the same commit, and reviewed in the same pull request, as the changes in the source strings from which they are extracted.
  2. Contributors and reviewers will have commit- and merge-time responsibility, respectively, for the quality of the source strings that get pushed to Weblate for translators to work with. (Thanks to the @Localization-Lab team for highlighting this consideration.)

Steps

  1. Remove the l10n GitHub Actions workflow.
  2. Define a new Make target check-translation-catalogs, which returns 0 iff make update-translation-catalogs is a no-op (i.e., git diff --quiet || exit 1 with a helpful warning).
  3. Add make check-translation-catalogs to the lint CircleCI job, making it a requirement for a pull request to pass CI.
  4. Investigate whether any of mechanizes continuous-localization workflow #1282's other Make targets can be obviated by using Weblate add-ons.
  5. Add a Git pre-commit hook for make {check,update}-translation-catalogs.
  6. Remove unnecessary Make targets (after step 4) and make sure remaining targets are documented in make help.
@cfm cfm added the i18n label Oct 20, 2021
@cfm cfm self-assigned this Oct 20, 2021
cfm added a commit that referenced this issue Oct 25, 2021
As a side effect, no .mo files will be compiled at runtime, and the
Client will fall back to the English source strings as if untranslated,
regardless of locale, until a revised version of this translation
worfklow is restored in #1317.
sssoleileraaa pushed a commit that referenced this issue Oct 25, 2021
As a side effect, no .mo files will be compiled at runtime, and the
Client will fall back to the English source strings as if untranslated,
regardless of locale, until a revised version of this translation
worfklow is restored in #1317.
@cfm
Copy link
Member Author

cfm commented Nov 30, 2021

@creviera and I met today to discuss proposals #1347 and #1348 and their background considerations. We affirmed our interest in these proposals over the previous #1282, because they:

  1. move source-string changes entirely into the commits that contain their originating code changes; and thereby
  2. make them, along with their accompany translation burden, visible to maintainers when they review pull requests.

Between the two options, we favor #1348, which:

  1. extracts string changes .py.pot via make update-strings, enforced via CI make check-strings;
  2. merges .pot.po via Weblate, prior to making .po catalogs available for translators to work on; and
  3. compiles .po.mo via Weblate, as part of the pull request to merge new translations into main.

Compared to #1347, (2) lets us minimize the noisiness of diffs in pull requests and eliminate some custom tooling. Compared to both #1347 and #1282, (3) lets us eliminate some custom tooling and its dependencies in securedrop-debian-packaging.

My next steps:

  1. Close provides tooling for interactive localization updates (option A) #1347
  2. Commit (or at least document) the removals suggested above
  3. Retest and mark provides tooling for interactive localization updates #1348 ready for @creviera's review

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