Globalization API: supportedLocalesOf vs. getSupportedLocales

Norbert Lindenberg ecmascript at norbertlindenberg.com
Mon Nov 28 18:15:24 PST 2011


The set of locales returned by a getSupportedLocales method would have to reflect what's actually supported by a Collator, NumberFormat, or DateTimeFormat implementation, so I doubt we'd get to the millions. Many of these 6000+ languages are spoken by fewer than 200 people, so certainly not in 200+ regions. And even where languages are spoken in many countries, there may not be defined regional variants: For example, I speak German and live in the U.S., but I don't know of any defined de-US collation, number format, or date format (in a German context, I'd use de-DE).

If we let the application pass in the languages that it's interested in, that would probably be based on what a user has requested, so rarely more than 10 languages. If English, French, Spanish, and Arabic are on the list, you might still get over 100 locales, but that's about it.

Norbert


On Nov 28, 2011, at 17:37 , Shawn Steele wrote:

> There are 6000+ languages, and presumably any of them could be spoken in 200+ regions.  There are additionally many variations of some of these languages.  So that's not a thousand locales, that's over a million locales.  Additionally there may be legitimate tags an application can support that it may have been originally designed for.  (Perhaps a new language or region or variant)  For an application that doesn't care much about the input locale, that's a lot of room for variety.
> 
> For applications that are only localized to a certain number of languages, then perhaps a getSupportedLocalizations() would be manageable.  Again though, that scope is narrow and may be inappropriate to use in other contexts.  Eg: my app is localized to only English, but someone uploaded French content, does that count?
> 
> -Shawn
> 
> -----Original Message-----
> From: es-discuss-bounces at mozilla.org [mailto:es-discuss-bounces at mozilla.org] On Behalf Of Norbert Lindenberg
> Sent: Monday, November 28, 2011 5:30 PM
> To: Eric Albright; Peter Constable; Shawn Steele
> Cc: es-discuss
> Subject: Re: Globalization API: supportedLocalesOf vs. getSupportedLocales
> 
> We invented the supportedLocalesOf method to let applications find out which of its requested locales are supported by the implementation of a service. A getSupportedLocales function that simply returns the locales that the implementation actually supports would be easier to understand, and could also be used by an application to implement its own locale negotiation. If I remember correctly, we chose not to offer getSupportedLocales primarily because the list returned might be huge - possibly over 1000 locales.
> 
> Maybe we should reconsider this? If an application really wants to have a list of 1000 locales, why not let it have it? If we want the ability to restrict the list, maybe there can be locale list as a parameter, and we return only those supported locales for which a prefix is on the locale list passed in? Or is there a more fundamental issue with getSupportedLocales?
> 
> Thanks,
> Norbert 
> 
> 
> On Nov 21, 2011, at 11:12 , Nicholas C. Zakas wrote:
> 
>> 2. supportedLocalesOf
>> 
>> I find this method name strange - I've read it several times and am still not sure I fully understand what it does. Perhaps "getSupportedLocales()" is a better name for this method? (I always prefer methods begin with verbs.)
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> 
> 



More information about the es-discuss mailing list