On 07/02/2017 19:38, zbranie...@mozilla.com wrote:
JS [2]:

```
const localeService = Components.classes["@mozilla.org/intl/localeservice;1"]
  .getService(Components.interfaces.mozILocaleService);

const appLocales = localeService.getAppLocales();

Please can you add an alias into Services.jsm so that Services.locale.<whatever> works ?

Also, that particular API looks like it might as well be a readonly attribute, which allows more concise use from JS while looking the same from C++:

const {appLocales} = Services.locale;

If your code can handle only one locale there's a helper
`GetAppLocale` which will retrieve just the top one, but in general, we
want to move to APIs that take full fallback chain to better fallback in
case the first locale is not available (that's how our l10n and intl
code will work).

I'm confused. The reason I normally ask for the locale that's currently in use from the chrome registry is because I want to know whether strings are going to be available for the feature I'm working on (esp. when relating to uplifts), based on a list I have with locales that have strings. If no strings are available, the feature is considered as not available, because we don't want to provide a half-language-X, half-language-Y experience. Getting the full locale chain is inappropriate for this - it's *intentional* that I ask only want the 'real' locale the user would like to and is able to use.

Conversely, if we're going to start providing the OS locale (which might not be reflected at all in the Firefox UI) as the first/top locale, that will also be wrong if the copy of Firefox we're running doesn't actually contain that locale and so all messages are in some other languages.

Worse, what happens in a situation where:
1) I'm using my OS in French
2) I'm running en-US Firefox
3) I'm installing an add-on that ships with localization into French.

I would argue that we should be providing a consistent UX and so both Firefox and the add-on should be using English, and the "which locale is Firefox using" API should return English, too. But your message implies that we'll return something like ["fr-FR", "en-US"], and that the add-on's strings will be in French and the rest of the UI will be in English. That seems wrong. Do I just misunderstand what the goal of this API is or how it's supposed to work? Can you clarify?

~ Gijs
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to