Intent to Implement: Intl.NumberFormat Unified API Proposal

5 views
Skip to first unread message

Frank Tang

unread,
May 17, 2019, 5:58:01 PM5/17/19
to v8-users, v8-...@googlegroups.com, blink-dev, Adam Klein, Sathya Gunasekaran, Nebojša Ćirić, Jungshik Shin, Shane Carr (Chromium)

Title: Intent to Implement: Intl.NumberFormat Unified API Proposal

 

Contact emails

ft...@chromium.com, sf...@chromium.com


Explainer

https://github.com/tc39/proposal-unified-intl-numberformat

https://tc39.github.io/proposal-unified-intl-numberformat/section11/numberformat_diff_out.html

https://tc39.github.io/proposal-unified-intl-numberformat/section6/locales-currencies-tz_diff_out.html

 


Design doc/Spec

https://goo.gl/ZAtL1f


Summary

Improves Intl.NumberFormat by adding support for measurement units, currency and sign display policies, and scientific and compact notation.


Motivation

There are many requests for adding number-formatting-related features to ECMA-402 for Intl.NumberFormat. These features are important to both end users and to websites. Since most of these features require carrying along large amounts of locale data for proper i18n support, exposing these features via a JavaScript API reduces bandwidth and lowers the barrier to entry for i18n best practices.

Rather than complicate Intl with more constructors with heavily overlapping functionality, this proposal is to restructure the spec of Intl.NumberFormat to make it more easily support additional features in a "unified" way.



Risks

Interoperability and Compatibility

This API change the pre-existing Intl.NumberFormat API by adding new options to control the formatted output. It is advanced to TC39 Stage 3 in the end of Oct 2018.


Ergonomics

The implementation depend on newer ICU class LocalizedNumberFormatter class, which require us to switch from the old NumberFormat. The switching in cl  1392233 speed up the Intl.NumberFormat constructor x4 in speed.

During the prototype phrase we identify a size increase issue of this proposal and work with the ECMA402 committee to reduce the scope of the number of “units” supported in the proposal.


Activation

Web developers could use the API immediately upon our shipment, based on the usage of previous well supported Intl.NumberFormat object.


Debuggability

Nothing special.

 

Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes.


Is this feature fully tested by web-platform-tests?

Tests under tc39/test262 will includes many tests to test this API. Under test262/tree/master/test/intl402/NumberFormat


Link to entry on the feature dashboard

https://www.chromestatus.com/feature/5430420699086848


Requesting approval to ship?

“No”. The feature is behind a runtime flag harmony_unified_intl_numberformat and I will later send an Intent to Ship email when I am ready to enable by default.


Reply all
Reply to author
Forward
0 new messages