Closed Bug 1566410 Opened 3 years ago Closed 3 years ago

Implement Intl.NumberFormat Unified API proposal

Categories

(Core :: JavaScript: Internationalization API, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: anba, Assigned: anba)

References

(Blocks 2 open bugs)

Details

(Keywords: dev-doc-complete)

Attachments

(11 files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review

Implement the "Intl.NumberFormat Unified API proposal" from https://github.com/tc39/proposal-unified-intl-numberformat.

Implements the changes to SetNumberFormatDigitOptions and FormatNumberToString,
except for the support of the new "compact-rounding" mode.

Also splits NumberFormatterSkeleton::currencyDisplay from NFS::currency for
consistency with the other new methods added as part of this bug.

Depends on D38335

This gives a nicer error when a sanctioned unit identifier isn't supported by
the current ICU.

Depends on D38336

Some parts of the proposal haven't yet stabilised enough to consider it safe to
let them ride the trains, so for now they're restricted to nightly-only:

  1. currencyDisplay
  • Latest decision was to rename "narrow-symbol" to "narrowSymbol".
  1. currencySign
  • Seems to have no open issues, so maybe okay to ship.
  1. unit and unitDisplay
  • List of supported units is still changing.
  1. notation and compactDisplay
  • There's an open issue at the proposal repository to change "compact" notation
    to match ICU's behaviour.
  1. signDisplay
  • Latest decision was to rename "except-zero" to "exceptZero".
  • "except-zero" implementation in ICU doesn't seem to match spec, see test cases.
  1. minimumIntegerDigits with fraction digits
  • This particular change seems safe to ship and won't be restricted to nightly-only.

Depends on D38337

Depends on D38338

Pushed by archaeopteryx@coole-files.de:
https://hg.mozilla.org/integration/autoland/rev/f7bdf614286f
Part 1: Apply "minimumIntegerDigits" to number-formatters with fraction-digits. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/092c670c39d8
Part 2: Change variable names in InitializeNumberFormat to match current spec. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/a4956d9ba377
Part 3: Add support for "signDisplay" option. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/72e2ae2d6b44
Part 4: Add support for "notation" and "compactDisplay" options. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/0cfc8d6f068b
Part 5: Add support for "currencySign" option. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/cf75de6c4bcf
Part 6: Add units to ICU data file. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/eac1f92a3634
Part 7: Add support for "unit"-style and "unitDisplay" options. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/4089aeb62e58
Part 8: Add support for "narrow-symbol" currency-display style. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/66f565be1e49
Part 9: Handle the case when a system ICU supports a different set of measurement units. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/d9c693ce8443
Part 10: Restrict proposal changes to nightly-only. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/3cc69158d573
Part 11: Enable test262 tests. r=jwalden

Keywords: checkin-needed
Regressions: 1568761
Blocks: 1609954
You need to log in before you can comment on or make changes to this bug.