Globalization API holiday summary
ecmascript at norbertlindenberg.com
Mon Jan 16 19:58:40 PST 2012
I can't find a specification for Object.system.load - does it return a reference to a single globally shared object representing the module, or does it return a new object that contains the exported functions/items of the module?
In the first case, I'd assume the object returned is immutable for security reasons, so we can't set its localeList. In the second case, how would the DateTimeFormat constructor find the intl variable that it's attached to?
On Dec 14, 2011, at 10:17 , Nebojša Ćirić wrote:
> Item we discussed the least is the global default locale. I would propose __Globalization.localeList property as a way of setting/reading default locale list. For example:
> var intl = Object.system.load('@globalization');
> intl.localeList = new intl.LocaleList(['sr', 'fr', 'de']);
> var dtf = new intl.DateTimeFormat(options);
> dtf.format(new Date());
> Both toLocaleString call and DateTimeFormat constructor would use intl.localeList as default locale list with the current value.
> There are 3 ways of picking which locale list to use:
> 1. DateTimeFormat has a valid localeList parameter. That parameter gets used - globals and defaults are ignored.
> 2. DateTimeFormat doesn't have localeList parameter specified:
> 2a. Use intl.localeList if defined.
> 2b. Use implementation specific default locale if intl.localeList was not defined.
> 3. Ultimate fallback is implementation specific default locale.
> What do you think?
More information about the es-discuss