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

[stable-4.5] Support ?pseudolocalization=true|false to enable/disable pseudolocalization; ?lang= to force language (#3225) #3244

Merged
merged 1 commit into from Jan 30, 2023

Conversation

himdel
Copy link
Collaborator

@himdel himdel commented Jan 30, 2023

Manual backport of #3225
(conflict becase userLanguage is no longer exported)


  • Support ?pseudolocalization=true|false to enable/disable pseudolocalization

Pseudlocalization (>>marking<< strings marked for translation, instead of actually translating them), is supported since #810 by setting localStorage.test_l10n = true in the browser console and reloading the page.

Note: the current lingui implementation needs npm run gettext:extract; npm run gettext:compile for any new strings before they appear as marked. We should try to remove that limitation during the i18next switch.

This PR makes it easier to enable/disable by setting a ?pseudolocalization=true/false URL param, which gets used to set/unset localStorage.test_l10n. (Thus, after using ?pseudolocalization=true once, you will see it until you explicitly set ?pseudolocalization=false, even when visiting URLs without the param.)

No-Issue
(but really AAP-4750)

  • Allow ?lang=ja to override detected language, ?lang= to unset it

Visiting the UI with ?pseudolocalization=true sets localStorage.test_l10n = true, and ?pseudolocalization=false does delete localStorage.test_l10n.

Now, also ?lang=ja sets localStorage.override_l10n = 'ja', and ?lang= does delete localStorage.override_l10n.

This allows the user to override the language by adding an URL param, and the UI will remember the choice until unset.

Also adding two console.debug messages when pseudolocalization or langugage override are enabled, with URLs to disable again.

…lization; `?lang=` to force language (ansible#3225)

* Support `?pseudolocalization=true|false` to enable/disable pseudolocalization

Pseudlocalization (>>marking<< strings marked for translation, instead of actually translating them),
is supported since ansible#810 by setting `localStorage.test_l10n = true` in the browser console and reloading the page.

> Note: the current lingui implementation needs `npm run gettext:extract; npm run gettext:compile` for any new strings before they appear as marked. We should try to remove that limitation during the i18next switch.

This PR makes it easier to enable/disable by setting a `?pseudolocalization=true/false` URL param,
which gets used to set/unset `localStorage.test_l10n`.
(Thus, after using `?pseudolocalization=true` once, you will see it until you explicitly set `?pseudolocalization=false`, even when visiting URLs without the param.)

No-Issue
(but really AAP-4750)

* Allow ?lang=ja to override detected language, ?lang= to unset it

Visiting the UI with `?pseudolocalization=true` sets `localStorage.test_l10n = true`,
and `?pseudolocalization=false` does `delete localStorage.test_l10n`.

Now, also `?lang=ja` sets `localStorage.override_l10n = 'ja'`,
and `?lang=` does `delete localStorage.override_l10n`.

This allows the user to override the language by adding an URL param,
and the UI will remember the choice until unset.

Also adding two `console.debug` messages when pseudolocalization or langugage override are enabled, with URLs to disable again.

(cherry picked from commit 6ba2b97)
@himdel himdel merged commit cc2cda6 into ansible:stable-4.5 Jan 30, 2023
@himdel himdel deleted the 45-3225 branch January 30, 2023 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant