Globalization API - Sample Use Cases

Nebojša Ćirić 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
> locale.
>
>  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.
>
> -N
>

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).

-- 
Nebojša Ćirić
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111206/74a081d6/attachment.html>


More information about the es-discuss mailing list