Proposal for NumberFormat and DateTimeFormat constructors
ecmascript at norbertlindenberg.com
Tue Aug 16 16:57:03 PDT 2011
The current specs for the NumberFormat and DateTimeFormat constructors in the ECMAScript internationalization API provide for 3 (NumberFormat) or 2 (DateTimeFormat) different ways to specify the desired formats: using style properties, using skeleton properties, and (for NumberFormat) using patterns. Skeletons for NumberFormat are awaiting clarification, and Eric (Microsoft) has proposed an alternative for DateTimeFormat skeletons.
I've been thinking about how this can be streamlined, and would like to propose:
1) Remove patterns from NumberFormat. I can imagine a few clients for which patterns would be useful, such as spreadsheet-type applications or value-added internationalization libraries. However, they require clients to provide localized patterns, and the number of applications for which this is both necessary and reasonable is fairly small. Most applications are better off using styles or skeletons, which let the implementation of the internationalization API fully take care of localization. (Patterns would actually be more useful for DateTimeFormat, where the limited number of supported skeletons will force more clients to roll their own, but there we don't offer them.)
2) Drop skeletons from NumberFormat, and instead offer additional properties through which clients can taylor the selected format style to their needs. I've written up an API proposal that provides the same functionality as skeletons.
3) Merge styles, skeletons, and the Microsoft proposal for DateTimeFormat into a unified approach with style values that are skeleton-like, but easier to understand, and can be added to in future versions of the API. I've written up an API proposal for this as well.
The API proposals are located at:
More information about the es-discuss