Globalization API - Sample Use Cases
cira at google.com
Tue Dec 6 12:48:40 PST 2011
> The easy solution to that is to add 2 more fields to the options (or have
> them as separate parameter):
> 1. pattern - as is, I know what I want - MM/yy always generates 9/74 no
> matter the locale.
> 2. skeleton - MM/yy will get you closest matching pattern for a given
> If pattern or skeleton fields are specified, we ignore the rest of the
> options object.
> We had this approach before and removed it from the spec to simplify the
> API, but it shouldn't be hard to get it back in.
> I like it. I'd even go one step further to suggest that the first argument
> be allowed as either a string or an object. If a string, then treat as a
> pattern, otherwise, treat as an options object.
So treat object as a skeleton*, and string as a plain pattern**? That may
be less confusing, and simple in simple case.
* - implementation picks best appropriate match, uses locale specific
delimiters, grouping separators...
** - provide formatting as is (as specified by LDML pattern). No locale
data is used (except some delimiters, say . and , for decimal separation).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss