Globalization API - Sample Use Cases

Nicholas C. Zakas standards at nczconsulting.com
Wed Dec 7 10:02:25 PST 2011


On 12/6/2011 12:48 PM, Nebojša Ćirić wrote:
>
>>     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).
Precisely.

-N

>
> -- 
> Nebojša Ćirić


-- 
___________________________
Nicholas C. Zakas
http://www.nczonline.net

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111207/bc94b40b/attachment.html>


More information about the es-discuss mailing list