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

Allow locale (not just language) to be set in Admin UI #1196

Closed
michaelbromley opened this issue Oct 25, 2021 · 1 comment
Closed

Allow locale (not just language) to be set in Admin UI #1196

michaelbromley opened this issue Oct 25, 2021 · 1 comment

Comments

@michaelbromley
Copy link
Member

Is your feature request related to a problem? Please describe.
Currently the Admin UI supports a number of display languages specified by the 2-character ISO 639-1 code, e.g. en, de.

The app then uses this code in order to localize things like number display and localized language names, using the Intl API.

However, with a couple of exceptions (Chinese and Portuguese), this setting does not allow us to make a distinction between different locales of this language, e.g. en-US vs en-GB vs en-MY. This can lead to localization that does not reflect the expected format for people from that locale.

For example, let's say we have a shop which uses Malaysian Ringgit, and we have our language set to "English". To format a price, we will be calling the following API:

new Intl.NumberFormat("en", { style: 'currency', currency: "MYR" }).format(1299)
// -> MYR 1,299.00

The problem is, people in Malaysia never refer to their currency as "MYR", they call it "RM" (Ringgit Malaysia). So we actually should be using the "en-MY" locale:

new Intl.NumberFormat("en-MY", { style: 'currency', currency: "MYR" }).format(1299)
// -> RM 1,299.00

Describe the solution you'd like
It should be possible to set the locale (i.e. which I think can be considered synonymous with country) independently of the language.

The existing "language" dialog in the UI top right menu should be extended to also allow a "locale" selection, which is a list of countries.

Also the ui config should have an extra field for default locale.

@michaelbromley
Copy link
Member Author

Reference on how the locale string is interpreted by the Intl API: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant