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

Specify localization handling #62

Open
4 tasks
dotproto opened this issue Aug 20, 2021 · 9 comments
Open
4 tasks

Specify localization handling #62

dotproto opened this issue Aug 20, 2021 · 9 comments

Comments

@dotproto
Copy link
Member

PR #61 introduces prose that more fully describes two manifest keys, name and short_name. The text for both of these keys tee up the topic of localization handling by stating "This property can be localized." The immediate question this phrasing raises is, "how?"

  • Describe the default_locale manifest key
  • Describe locale-specific messages files
  • Describe how a locale JSON file is selected
  • Describe how placeholders are replaced with localized text

Related prior art to consider when specifying localization behavior includes:

@carlosjeurissen
Copy link
Contributor

Part of this also includes what language codes to support. This greatly varies between browsers. Google prefers es_419 for example, while microsoft edge uses es_MX.

Then there is the Naver Whale Store which doesn't allow submissions with non-country suffixes like:
zh_Hant, zh_Hans, zh_Hant_HK. sr_Latn and ca_valencia

@dotproto
Copy link
Member Author

Thanks for calling out that browser and their respective stores don't all agree on the same set of language codes. That's definitely something we will need to figure out how to navigate. If we can't arrive at a consensus on a single set of language codes among browser vendors, we may have to specify around this issue.

@xfq
Copy link
Member

xfq commented Sep 16, 2021

Just FYI - the W3C Internationalization Working Group is working on a document for Developing Localizable Manifests.

@carlosjeurissen
Copy link
Contributor

carlosjeurissen commented Oct 4, 2021

Something else to add here is the difference between the browser language (i18n.getUILanguage) and the language websites are requested in (i18n.getAcceptLanguages). Depending on what the extension does in the browser, there are cases when the extension prefers to use translations based on i18n.getAcceptLanguages instead of i18n.getUILanguage. For example, in content_script contexts.

@carlosjeurissen
Copy link
Contributor

The issue in Naver Whale store related to language codes which are not accepted can be found here:
https://forum.whale.naver.com/topic/39749/

The reply from Naver Whale so far is that they don't plan to make changes here. Even tho it would be ideal to simply ignore the unsupported language codes.

@carlosjeurissen
Copy link
Contributor

@dotproto We can add to your list of action items the following:
Defining how language fallbacks are used. Currently browsers have a very specific algorithm to fetch a translation.

As input, the messageId is given. And the browser knows the browser UI language. Say this is es_419. The browser will then first try finding a es_419/messages.json file, and if found and the message is there, use it. If not, it will look for a es/messages.json file and find the message in this file. If it's not present either, fall back to the language defined in default_locale.

@carlosjeurissen
Copy link
Contributor

carlosjeurissen commented Oct 7, 2021

Something else to add here is the difference between the browser language (i18n.getUILanguage) and the language websites are requested in (i18n.getAcceptLanguages). Depending on what the extension does in the browser, there are cases when the extension prefers to use translations based on i18n.getAcceptLanguages instead of i18n.getUILanguage. For example, in content_script contexts.

A potential way to implement this would be to accept a language as input for i18n.getMessage. This would also make it easier for developer to allow the user to set a specific language used in the extension. See https://crbug.com/660704

@carlosjeurissen
Copy link
Contributor

As mentioned here, related to localization. Seems it makes sense to deprecate i18n.getAcceptLanguages. See: #107

@carlosjeurissen
Copy link
Contributor

As mentioned by @dotproto in this Google Group:
https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/6ff8460f-68df-4d50-8128-f50a8a84c9ccn%40chromium.org

The chrome web store and chromium used to tolerate comments in language locale messages.json files. Yet at least for the store dropped this support to align with manifest.json and standard json specs.

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

4 participants