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

feat: update all languages in Weblate, but only offer supported ones in securedrop-admin sdconfig #6557

Merged
merged 4 commits into from
Sep 22, 2022

Conversation

cfm
Copy link
Member

@cfm cfm commented Sep 22, 2022

Status

Ready for review

Description of Changes

Towards #6156, which (with these changes) should be completed automatically as part of the v2.5.0 localization cycle.

Closes #6387 by:

  1. creating a canonical list of supported languages in securedrop/i18n.json;
  2. relaxing i18n_tool.py update-from-weblate to pull translations for all locales available for translation in Weblate; thereby also
  3. relaxing i18n_tool.py translate-{messages,desktop} to update source strings for all locales available for translation in Weblate; while
  4. restricting securedrop-admin sdconfig to allow administrators to select only those languages both present (in the securedrop repository) and supported (in i18n.json).

Testing

securedrop-admin sdconfig

This is the higher priority for testing, since it is an administrator-facing change.

  1. Check out 6387-supported-languages.
  2. Run securedrop-admin sdconfig and attempt to enable a nonexistent locale (e.g., foo).
    • The nonexistent locale is rejected.
  3. Run securedrop-admin sdconfig and attempt to enable any two or more supported locales (e.g., en_US de_DE ro).
    • All locales are accepted.
  4. For one of the locales you enabled in step (3), delete the corresponding directory from securedrop/translations. Then run securedrop-admin sdconfig.
    • The locale no longer suggested and is rejected, because it is no longer present.
  5. For another of the locales you enabled in step (3), delete the corresponding supported_locales entry in securedrop/i18n.json. Then run securedrop-admin sdonfig.
    • The locale is no longer suggested and is rejected, because it is no longer supported.

i18n_tool.py

This is the lower priority for testing, since it's a tooling change we can tweak in place if necessary, including during the localization cycle.

  • Run securedrop/i18n_tool.py update-from-weblate.

  • An INFO is logged to the standard output for each unsupported language like:

    f"{code} has translations but is not marked as supported; "
    f"skipping desktop translation"

  • Changes to all languages, not only supported ones, are fetched, checked out, staged, and committed.

Deployment

These changes should be invisible to the administrators of any correctly-configured SecureDrop instance. If (e.g.) an instance has custom translations installed, these will be unavailable after the next securedrop-admin sdconfig. If in the future we drop support for a language we currently support, administrators will have to update their configured locales on their next securedrop-admin sdconfig.

Checklist

If you made changes to the server application code:

  • Linting (make lint) and tests (make test) pass in the development container

If you made changes to securedrop-admin:

  • Linting and tests (make -C admin test) pass in the admin development container

If you made non-trivial code changes:

  • I have written a test plan and validated it for this PR

Choose one of the following:

  • I have opened a PR in the docs repo for these changes, or will do so later

Documentation will follow from me and/or @eaon as Localization Managers for the v2.5.0 release.

  • I would appreciate help with the documentation
  • These changes do not require documentation

cfm added 3 commits August 17, 2022 17:25
update_from_weblate() now stages changes (a) for all locales updated
from the securedrop/securedrop component but (b) for only supported
locales updated from the securedrop/desktop component, since this link
is defined explicitly in the I18N_CONF file.

commit_changes(), which is called only from update_from_weblate(), now
takes a list of paths to check for staged changes and returns if "git
commit" would be a no-op.
@cfm cfm assigned eaon Sep 22, 2022
@cfm cfm requested a review from a team as a code owner September 22, 2022 05:32
@cfm cfm added this to the 2.5.0 milestone Sep 22, 2022
@cfm cfm added i18n Anything related to translation or internationalization of SecureDrop goals: improve developer workflow labels Sep 22, 2022
Existing tests check for the availability of the de_DE, es_ES, and fr_FR
locales, so we mark them as "supported_locales".  Some tests need to be passed
"tmpdir" in order to instantiate a fully-parameterized SiteConfig.
@cfm cfm force-pushed the 6387-supported-languages branch from dc64ca5 to 01ba0bd Compare September 22, 2022 05:52
Copy link
Contributor

@eaon eaon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took my time with this one because I had no prior experience with our i18n/l10n infrastructure. Happy to report that the test plan checks out, and the changes seem like a good pragmatic next step to improve admin-facing and developer-facing systems. Thanks @cfm!

@eaon eaon merged commit ce7077d into develop Sep 22, 2022
@eaon eaon deleted the 6387-supported-languages branch September 22, 2022 20:07
@cfm cfm mentioned this pull request Sep 22, 2022
4 tasks
cfm added a commit to freedomofpress/securedrop-dev-docs that referenced this pull request Oct 5, 2022
cfm added a commit to freedomofpress/securedrop-dev-docs that referenced this pull request Oct 5, 2022
cfm added a commit to freedomofpress/securedrop-dev-docs that referenced this pull request Oct 5, 2022
After freedomofpress/securedrop#6557, in lieu of a Venn diagram.

I regret that I did not manage to use identical terminology between
freedomofpress/securedrop#6406 and freedomofpress/securedrop#6557.
@zenmonkeykstop
Copy link
Contributor

Looks like Arabic didn't make it into i18n.json. Was that by design or an oversight?

cfm added a commit to freedomofpress/securedrop-dev-docs that referenced this pull request Oct 19, 2022
cfm added a commit to freedomofpress/securedrop-dev-docs that referenced this pull request Oct 19, 2022
After freedomofpress/securedrop#6557, in lieu of a Venn diagram.

I regret that I did not manage to use identical terminology between
freedomofpress/securedrop#6406 and freedomofpress/securedrop#6557.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
goals: improve developer workflow i18n Anything related to translation or internationalization of SecureDrop
Projects
None yet
Development

Successfully merging this pull request may close these issues.

centralize list of supported languages
3 participants