-
Notifications
You must be signed in to change notification settings - Fork 80
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
+50
−9
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…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)
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.
?pseudolocalization=true|false
to enable/disable pseudolocalization?pseudolocalization=true|false
to enable/disable pseudolocalization; ?lang=
to force language
MilanPospisil
approved these changes
Jan 27, 2023
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
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)
This was referenced Jan 30, 2023
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)
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)
Merged
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)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
?pseudolocalization=true
(false
to unset) URL param, which gets used to set/unsetlocalStorage.test_l10n
.?lang=ja
(?lang=
to unset) URL param, which gets used to set/unsetlocalStorage.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 theAccept-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.)