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

enable automatically-generated "pseudolocale" #6690

Closed
7 tasks done
cfm opened this issue Nov 22, 2022 · 2 comments
Closed
7 tasks done

enable automatically-generated "pseudolocale" #6690

cfm opened this issue Nov 22, 2022 · 2 comments
Assignees
Labels
i18n Anything related to translation or internationalization of SecureDrop

Comments

@cfm
Copy link
Member

cfm commented Nov 22, 2022

#6380 (comment):

Why are these omissions so difficult to catch during manual testing in the string-freeze process? At that point in the localization cycle, strings not (or incorrectly) marked for translation are indistinguishable from strings not yet translated.

We could solve this problem at least for human eyes by turning on Weblate's "pseudolocale generation":

Pseudolocales are useful to find strings that are not prepared for localization. This is done by altering all translatable source strings to make it easy to spot unaltered strings when running the application in the pseudolocale language.

Originally posted by @cfm in #6380 (comment)


Testing

In freedomofpress/securedrop-i18n-sandbox from weblate-sandbox.securedrop.org:

  1. Pseudolocale defined: https://weblate-sandbox.securedrop.org/projects/securedrop/securedrop/eo/
  2. Pseudolocale generation configured
  3. Pseudolocale can be added manually to securedrop/i18n.json
  4. Under make dev, pseudolocale can be selected in Source and Journalist Interfaces

Production

In freedomofpress/securedrop-i18n from weblate.securedrop.org:

@cfm cfm added the i18n Anything related to translation or internationalization of SecureDrop label Nov 22, 2022
@cfm cfm added this to the 2.6.0 milestone Nov 22, 2022
@cfm cfm self-assigned this Nov 22, 2022
@cfm
Copy link
Member Author

cfm commented Jan 5, 2023

I've configured the "pseudolocale generation" add-on at weblate-sandbox.securedrop.org with these settings per Weblate and Microsoft recommendations:

Setting Value
Source strings English
Fixed string prefix [
Variable string prefix !
Fixed string suffix ]
Variable string suffix !
Variable part multiplier 0.1

For the Target language setting, I tried both Weblate's recommended en_XA and a custom "unknown" locale und_US. Even once added in securedrop/i18n.json, neither is usable by Babel because neither is present in the Unicode Common Locale Data Repository:

>>> import babel
>>> babel.Locale.parse('en_XA')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/securedrop/.venv/lib/python3.9/site-packages/babel/core.py", line 330, in parse
    raise UnknownLocaleError(input_id)
babel.core.UnknownLocaleError: unknown locale 'en_XA'
>>> babel.Locale.parse('und_US')
Locale('en', territory='US')  # collides with real en_US

We ran into a version of this problem in #6406, where under test we cheekily defined:

NEVER_LOCALE = 'eo' # Esperanto

I'll have to think more about this.

@cfm
Copy link
Member Author

cfm commented Jan 13, 2023

Having tried en_devel in addition to en_XA and und_US, we'll have to use NEVER_LOCALE = 'eo' after all, at least until Babel supports custom locales (python-babel/babel#454). I've created eo in production Weblate, configured the "Pseudolocale Generation" add-on, and documented how to use eo in QA in https://github.com/freedomofpress/securedrop/wiki/QA-Procedures#localization-qa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n Anything related to translation or internationalization of SecureDrop
Projects
None yet
Development

No branches or pull requests

1 participant