-
Notifications
You must be signed in to change notification settings - Fork 63
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
Comments
Also relevant: #131 We should also align on properly formatted locale tags: 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). |
@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? |
@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:
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 |
@hanguokai If matching and fallbacks are not of any concern. What do you expect browsers to change here? What is the actionable items for this issue? |
@carlosjeurissen Yes, how to best fallback is another issue. Currently, the browser just doesn't support these locales. For example, you set your OS/Browser to zh_Hant_HK or zh_Hans_HK , and put an exactly message file in BTW: I read the file structure and data content of CLDR and they have a hierarchy of structure and override handling, similar to extensions. |
@hanguokai right. I believe this is by design. The Browser has a limited set of languages it has translations for. It will try to find the closest match based on the preference of your OS/Browser. This is not related to some browsers allowing you to customise the For extensions, browsers will use the language the browser resolved to as to prevent having mixed languages. Correct me if I am wrong but I believe this is how it works in all browsers currently. For missing messages, a specific fallback algorithm is used, see #296 This is one of the motivations of introducing |
@carlosjeurissen I never talk about HTTP accept-language header or the current browser implementation. There is not much to discuss about this issue itself, it is just a feature to be supported (implemented) in the future. |
@hanguokai Currently there is no browser which throws warnings or errors when an extension is loaded with locales tags including script subtags (like The only extension store rejecting such tags is Whale Extension Store. See this post I opened in 2021 on their forum https://forum.whale.naver.com/topic/39749/. The Whale Extension Store only accepts the primary subtags ( Just trying to understand you here. Do you wish to change the browsers behaviour to directly use the OS language for extension messages independently of what language the browser UI is displayed in? (Instead of the current behaviour in which the browser UI language is used for extension messages). |
Locale Format
Locale identifier consists of language subtag, script subtag, region subtag, and one or more variant subtags.
For example,
zh-CN
andzh-TW
are language + region. They mean Chinese in different regions.zh-Hans
andzh-Hant
are language + script. They mean Simplified Chinese and Traditional Chinese without regions.zh-Hans-CN
,zh-Hans-SG
,zh-Hant-HK
andzh-Hant-TW
are language + script + region. They mean Simplified Chinese and Traditional Chinese in different regions.For historical reasons,
zh-CN
andzh-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:
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
setCurrentLanguage()
allows to be passed in.i18n.getMessage()
language fallback paths #296 @birtles and @xeenon discussed this issue. And related links: zh_hans locale not working birchill/10ten-ja-reader#2051 https://issues.chromium.org/issues/375528194The text was updated successfully, but these errors were encountered: