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

I18N: Support more valid locales: language-script and language-script-region #724

Open
hanguokai opened this issue Nov 15, 2024 · 3 comments
Labels
i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. implemented: safari Implemented in Safari needs-triage: chrome Chrome needs to assess this issue for the first time neutral: firefox Not opposed or supportive from Firefox topic: localization

Comments

@hanguokai
Copy link
Member

hanguokai commented Nov 15, 2024

Locale Format

Locale identifier consists of language subtag, script subtag, region subtag, and one or more variant subtags.

For example,

  • zh-CN and zh-TW are language + region. They mean Chinese in different regions.
  • zh-Hans and zh-Hant are language + script. They mean Simplified Chinese and Traditional Chinese without regions.
  • zh-Hans-CN, zh-Hans-SG, zh-Hant-HK and zh-Hant-TW are language + script + region. They mean Simplified Chinese and Traditional Chinese in different regions.

For historical reasons, zh-CN and zh-TW are often used to represent Simplified Chinese and Traditional Chinese, but this is not rigorous or accurate.

The current level of support

Goal

All browsers support all valid locales, including:

  • language + region
  • language + script
  • language + script + region

Note: The languages supported by the browser and the languages supported by the extension store should be two different things, but there is some correlation.

Other discussions

@github-actions github-actions bot added needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time needs-triage: safari Safari needs to assess this issue for the first time labels Nov 15, 2024
@hanguokai hanguokai added implemented: safari Implemented in Safari topic: localization i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. and removed needs-triage: safari Safari needs to assess this issue for the first time labels Nov 15, 2024
@carlosjeurissen
Copy link
Contributor

Also relevant: #131
Which compiles a list of the current situation in terms of what locale tags are supported by what browser/stores:
https://docs.google.com/spreadsheets/d/1N0f9Nl-PM_nafpJEfYbS8xV9Qvb6o6DvuBFWLTXRr2Y/edit#gid=1518318975

We should also align on properly formatted locale tags:
#642

The webExtension Stores should also receive support for this. Currently the Naver Whale extension store does not support loading extensions with locale tags which include script subtags (like sr-Latn or zh-Hans).

@carlosjeurissen
Copy link
Contributor

@hanguokai in terms of support. What do you expect from browsers? Say the browser uses "zh-CN" as locale. And the extension only has "zh-Hans" and "zh-Hant", should it actively search for a best match and pick "zh-Hans"? Or should it just be able to accept extensions which have locale files using language tags containing a script subtag?

@Rob--W Rob--W added neutral: firefox Not opposed or supportive from Firefox and removed needs-triage: firefox Firefox needs to assess this issue for the first time labels Nov 21, 2024
@hanguokai
Copy link
Member Author

@carlosjeurissen and other guys in last meeting, you seem to be discussing how to match and fallback. These are the implementation details, I am not very concerned about them yet. (Currently, no one has sponsored the implementation of it). I think the people who designed Locale/I18N system must have considered these issues, so we shouldn't reinvent anything new here.

I found a bit of relevant information (I18N experts are welcome to provide more useful information and reference implementations). BCP 47:

My high-level thoughts are:

  1. Browsers support these locale format messages files. For specific parts that are not supported (different browser implementations may vary), the browser can ignore it, or at least don't throw errors or refuse to publish the extension to the store.
  2. Make the best possible matches and fallbacks.

For developers, when browser support is incomplete or inconsistent, developers can at least copy multiple copies of the same content as a workaround. For example, developers can provide both zh-CN, zh-TW, zh-HK, and zh-Hans, zh-Hant in the extension. Note that Chinese is just a typical example here, there are many other languages and scripts or regional differences in the world.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. implemented: safari Implemented in Safari needs-triage: chrome Chrome needs to assess this issue for the first time neutral: firefox Not opposed or supportive from Firefox topic: localization
Projects
None yet
Development

No branches or pull requests

3 participants