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

Support ?pseudolocalization=true|false to enable/disable pseudolocalization; ?lang= to force language #3225

Merged
merged 2 commits into from
Jan 30, 2023

Conversation

himdel
Copy link
Collaborator

@himdel himdel commented Jan 25, 2023

Issue AAP-4750

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.)

User language is currently autodetected based on browser settings, with no way to change.


This PR makes it easier to:

  • enable/disable pseudolocalization by setting a ?pseudolocalization=true (false to unset) URL param, which gets used to set/unset localStorage.test_l10n.
  • force a different langugage by setting a ?lang=ja (?lang= to unset) URL param, which gets used to set/unset localStorage.override_l10n.

Thus, after using ?pseudolocalization=true&lang=ja once, you will see both until you explicitly set ?pseudolocalization=false&lang=, even when visiting URLs without the param.

Note: ?lang only affects UI locale, not API locale, which is based solely on the Accept-Language header.
(And pseudolocalization never affected the API either, though django gettext might have a default way of doing that.)

(Both pseudolocalization and languge override also console.debug links to unset them.)

…lization

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)
@github-actions github-actions bot added backport-4.5 This PR should be backported to stable-4.5 (2.2) backport-4.6 This PR should be backported to stable-4.6 (2.3) labels Jan 25, 2023
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.
@himdel himdel changed the title Support ?pseudolocalization=true|false to enable/disable pseudolocalization Support ?pseudolocalization=true|false to enable/disable pseudolocalization; ?lang= to force language Jan 25, 2023
@himdel himdel merged commit 6ba2b97 into ansible:master Jan 30, 2023
@himdel himdel deleted the aap4750 branch January 30, 2023 02:30
@patchback

This comment was marked as outdated.

@patchback

This comment was marked as outdated.

himdel added a commit to himdel/ansible-hub-ui that referenced this pull request Jan 30, 2023
…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 added a commit to himdel/ansible-hub-ui that referenced this pull request Jan 30, 2023
…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 added a commit that referenced this pull request Jan 30, 2023
…lization; `?lang=` to force language (#3225) (#3245)

* 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.

(cherry picked from commit 6ba2b97)
@github-actions github-actions bot added the backported-4.6 This PR has been backported to stable-4.6 (2.3) label Jan 30, 2023
himdel added a commit that referenced this pull request Jan 30, 2023
…lization; `?lang=` to force language (#3225) (#3244)

* 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.

(cherry picked from commit 6ba2b97)
@github-actions github-actions bot added the backported-4.5 This PR has been backported to stable-4.5 (2.2) label Jan 30, 2023
@himdel himdel mentioned this pull request Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-4.5 This PR should be backported to stable-4.5 (2.2) backport-4.6 This PR should be backported to stable-4.6 (2.3) backported-4.5 This PR has been backported to stable-4.5 (2.2) backported-4.6 This PR has been backported to stable-4.6 (2.3)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants