Globalization API holiday summary

Norbert Lindenberg ecmascript at norbertlindenberg.com
Mon Jan 16 19:45:46 PST 2012


A few comments below.

Norbert


On Dec 8, 2011, at 10:25 , Nebojša Ćirić wrote:

> There are couple of threads going on and I wanted to wrap up current state before the holidays...
> 
> API:
>  1. Use built in toLocaleString family of methods in simple, functional case*
>  2. Use Globalization API as proposed (with some tweaks) for complex scenarios**
> 
> * - http://wiki.ecmascript.org/doku.php?id=strawman:globalization-integration
> ** - http://wiki.ecmascript.org/doku.php?id=globalization:specification_drafts

The specification draft of December 1 already includes an improved version of the toLocaleString/localeCompare redefinitions.

> Proposed changes to the original API:
[snip]
>   2a. What happens with toLocaleString methods when user doesn't load @globalization module?

I think they should work as specified in the Globalization API spec regardless. You don't want to get different results from these methods depending on whether some component on the page has loaded the module or none has.

>  3. Accept either a String (LDML) or an option Object as a format parameter in formatters. Simplifies the simple use case and loading resources from files.
>   3a. In addition to DateTimeFormat({year:'long'}) one can DateTimeFormat("yyyy").

These are not the same at all. According to the current spec, {year:'long'} is a request "give me a pre-made format with a longish date and no other component if you have such a format; otherwise give me whatever pre-made format you feel fits best, for example one including a year and a month and some decorative characters." If patterns work as in LDML, then {pattern: "yyyy"} means "format the year of the given date into a number with at least four digits" and nothing else.

[snip]



More information about the es-discuss mailing list