yui/yui3 — pull request #1185 by ashiksmd (2013-09-12 12:08:53+00:00)
Title: Advanced Number and list formatting

This adds advanced number and list formatting. Because of the large data size, after discussions with the YUI team, locales other than the root locale have been removed for now. Any additional locales can be added later as required, or be made available through the gallery if possible.

datatype-number-format currently offers a limited number formatting API. The new module datatype-number-format-advanced extends this feature to support more locale dependent behavior. The parameters like prefix, suffix and separators to define how to format the numbers are now automatically determined according to the locale and the style parameter set by the user, instead of forcing the user to define it every time.

datatype-list-format adds support for formatting lists. For example, the array ["US", "UK", "Canada"] when passed to Y.Array.format() will return "US, UK and Canada" for English. The output differs according to the locale.

Eventually, when we add message formatting, these modules will be used by the message format module to format numbers and lists. We also plan to add date formatting modules later.

Some of the questions asked during previous pull request were:

1. Who will use these features?
Internationalization is a key requirement for Yahoo properties as well as any application/service used by a growing majority of the world. The internationalization code offered with this pull is designed to use international standards and make YUI the best option for use in all JS code. Without this enhancement, jquery has significantly more advanced internationalization features.

2. Why should this functionality be in YUI core instead of the gallery?
We are looking to have this code in YUI core as correct internationalization becoming more important due to the growing number of international users. Yahoo needs to have this as a core competency of YUI. Having it as an option leaves limited functionality as the default core behavior.

3. Who will maintain these features and the massive amount of metadata associated with them?
CLDR is the Common Locale Data Repository. It is an open source project that collects and maintains current standards for many different internationalization feature data sets. This is the basis of what we are using for date formats (absolute, relative & duration) , number formats, etc.
By leveraging CLDR data, YUI can stay abreast of current standards without needing to maintain, organize or collect the information.
Regardless, as mentioned earlier, the locale data has been removed from this pull request. Only the root locale remains. Any other locale can be added later on as required, or made available through gallery if possible.

4. Does this align with the emerging spec?
This is making use of the ECMA code where possible. The current ECMA spec does not include all of the different internationalization features being worked on here.

5. What is the core use case this PR aims to provide?
Improved internationalization support for Yahoo properties. As a byproduct of this, it would also improve any user of the open source code that intended to gain access to additional language/region markets.