-
Notifications
You must be signed in to change notification settings - Fork 11
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
l10n: extract remaining strings to prepare for localization #558
Conversation
d743d1d
to
c82b47e
Compare
Devices didn't previously have a consistent way of providing the user's current language to autofill pages. Add `.userPreferences.language` as an optional string value for platforms to provide as part of their runtime configurations.
The device/platform abstraction is responsible for providing a two-character language code, and uses that language code to provide a translation function with simple ICU-style replacements. Translations are currently hardcoded within src/locales/strings.js, but a future commit will extract those to JSON files in language-specific subtrees.
To enable a localized autofill experience in a language consistent with the DuckDuckGo Privacy Essentials extension, the extension must provide the current language code in its runtime configuration. Specifically via the `.userPreferences.language` string property. Luckily, the extension already provide a language code under `.contentScope.locale`, so there's no additional plumbing required. Copy the already-present language code to the expected location within userPreferences.
We'll be translating the entire autofill experience shortly, but those translated strings aren't yet ready. Use translated text on a single button (the "Use <personal duck address>" button on signup forms) to exercise the translation flow end-to-end. Since only 'en' is supported for translation at the moment, this has no visible change to users.
c82b47e
to
c9f49c5
Compare
@sjbarag thanks! it looks like there might be some integration tests to update? |
Localization will be simplest once we have all to-be-translated strings in one place. Find all remaining hardcoded English strings and pull them into strings.js. A future commit will automate building that file based on downloaded language-specific JSON files.
c9f49c5
to
4e2a117
Compare
The tests worked! I mistyped a string ID 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sjbarag
I tested this on macOS, with a forced xa
language (in autofill) and your dummy language showed as expected!
I think this is good to go, nice work!
Task/Issue URL: https://app.asana.com/0/1207623126907992/1207623126907992 Autofill Release: https://github.com/duckduckgo/duckduckgo-autofill/releases/tag/12.0.0 ## Description Updates Autofill to version [12.0.0](https://github.com/duckduckgo/duckduckgo-autofill/releases/tag/12.0.0). ### Autofill 12.0.0 release notes * Major version bump to 12.0.0 caused by #396, which impacts only Android. * This release also translates the autofill experience to the following language codes: * bg * cs * da * de * el * en * es * et * fi * fr * hr * hu * it * lt * lv * nb * nl * pl * pt * ro * ru * sk * sl * sv * tr ## What's Changed * Ema/more minor fixes by @GioSensation in duckduckgo/duckduckgo-autofill#556 * l10n: extract remaining strings to prepare for localization by @sjbarag in duckduckgo/duckduckgo-autofill#558 * l10n: pull translated strings into separate JSON files by @sjbarag in duckduckgo/duckduckgo-autofill#559 * Update password-related json files (2024-05-13) by @daxmobile in duckduckgo/duckduckgo-autofill#561 * Update password-related json files (2024-05-19) by @daxmobile in duckduckgo/duckduckgo-autofill#569 * vcs: ignore .helix directory by @sjbarag in duckduckgo/duckduckgo-autofill#565 * l10n: remove placeholder from 'Manage ${ITEM}…' string by @sjbarag in duckduckgo/duckduckgo-autofill#560 * real-world: remove expected failure from clientssp.fnfis.com test by @sjbarag in duckduckgo/duckduckgo-autofill#563 * real-world: remove expected failure for agile.appian.com by @sjbarag in duckduckgo/duckduckgo-autofill#567 * autofill: left-align HTML autofill buttons by @sjbarag in duckduckgo/duckduckgo-autofill#571 * l10n: add translated messages by @sjbarag in duckduckgo/duckduckgo-autofill#572 * passwords: require a digit in passwords generated from default rules by @sjbarag in duckduckgo/duckduckgo-autofill#562 * classifiers: fix another batch of test page expected username failures by @sjbarag in duckduckgo/duckduckgo-autofill#573 * Update password-related json files (2024-05-30) by @daxmobile in duckduckgo/duckduckgo-autofill#577 * Update password-related json files (2024-05-31) by @daxmobile in duckduckgo/duckduckgo-autofill#578 * l10n: update translations based on ship review feedback by @sjbarag in duckduckgo/duckduckgo-autofill#581 * android: Revert "Android: enable iframe support (#536)" by @sjbarag in duckduckgo/duckduckgo-autofill#582 ## New Contributors * @sjbarag made their first contribution in duckduckgo/duckduckgo-autofill#558 **Full Changelog**: duckduckgo/duckduckgo-autofill@11.0.2...12.0.0 ## Steps to test This release has been tested during autofill development. For smoke test steps see [this task](https://app.asana.com/0/1198964220583541/1200583647142330/f). Co-authored-by: sjbarag <665775+sjbarag@users.noreply.github.com>
ℹ️ This is based on #541, so ignore the first four commits when reviewing 😄
Reviewer: @shakyShane
Asana: https://app.asana.com/0/0/1207226904496414/f
Description
Localization will be simplest once we have all to-be-translated strings in one place. Find all remaining hardcoded English strings and pull them into strings.js. A future commit will automate building that file based on downloaded language-specific JSON files.
Steps to test
npm run test
for the localization systemThere should be no other user-facing changes (unless you force yourself into
language: 'xa'
)