Use intl::NumberFormat to format numbers in SpiderMonkey
Categories
(Core :: Internationalization, enhancement, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox90 | --- | fixed |
People
(Reporter: dminor, Assigned: dminor)
References
(Blocks 1 open bug)
Details
(Whiteboard: [i18n-unification])
Attachments
(9 files, 1 obsolete file)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Once the "unified" intl::NumberFormat implementation lands in Bug 1695937, the next step will be to support the full Intl.NumberFormat API, and switch SpiderMonkey over to using it.
Assignee | ||
Comment 1•3 years ago
|
||
Assignee | ||
Comment 2•3 years ago
|
||
This temporarily adds intl::NumberFormatterSkeleton to the public API so that
we can use it in PluralRules. This allows us to remove the SpiderMonkey
NumberFormatterSkeleton implementation when we convert SpiderMonkey to use
intl::NumberFormat.
We can remove intl::NumberFormatterSkeleton from the public API when we
implement intl::PluralRules in Bug 1704509.
Depends on D111886
Assignee | ||
Comment 3•3 years ago
|
||
Depends on D111887
Assignee | ||
Comment 4•3 years ago
|
||
The SpiderMonkey call sites need both the pointer and the length when
copying/deflating the string, so this changes the API to expose the underlying
string_view.
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Comment 5•3 years ago
|
||
Depends on D111888
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Comment 6•3 years ago
|
||
Depends on D112802
Assignee | ||
Comment 7•3 years ago
|
||
This should be CurrencyDisplay to be consistent with ecma-402.
Depends on D112801
Assignee | ||
Comment 8•3 years ago
|
||
I foolishly dropped these when bringing the code over from SpiderMonkey.
Depends on D113557
Assignee | ||
Comment 9•3 years ago
|
||
Assignee | ||
Comment 10•3 years ago
|
||
This adds a fallible factory method to create new NumberFormat instances. This
allows us to report initialization errors at time of initialization, rather than
when format is called, and remove internal checks in the implementation for
successful initialization.
To support using the SpiderMonkey allocators, the TryCreate method optionally
takes an allocator as an argument and a DeletePolicy as template argument.
Default values are provided so that these do not need to be specified in Gecko
code.
The existing fluent code assumes that creating a NumberFormat instance always
succeeds. This patch updates that code to handle failures.
Depends on D113145
Assignee | ||
Comment 11•3 years ago
|
||
This adds a fallible factory method to create new NumberFormat instances. This
allows us to report initialization errors at time of initialization, rather than
when format is called, and remove internal checks in the implementation for
successful initialization.
The existing fluent code assumes that creating a NumberFormat instance always
succeeds. This patch updates that code to handle failures.
Depends on D113145
Updated•3 years ago
|
Assignee | ||
Comment 12•3 years ago
|
||
Assignee | ||
Comment 13•3 years ago
|
||
All the SpiderMonkey jobs, just in case: https://treeherder.mozilla.org/jobs?repo=try&revision=58f5f40a0ac272e4e07cdadf0eec96325caa9e0e
Comment 14•3 years ago
|
||
Pushed by dminor@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9c0dbc73dad2 Return std::u16string_view instead of char16_t* in intl::NumberFormat r=gregtatum https://hg.mozilla.org/integration/autoland/rev/89ff5f91d8e9 Rename NumberFormatOptions::CurrencyDisplayStyle; r=gregtatum https://hg.mozilla.org/integration/autoland/rev/216472b634b9 Restore [[nodiscard]] annotations to NumberFormatterSkeleton; r=gregtatum https://hg.mozilla.org/integration/autoland/rev/4239fe67d69f Add support for format to parts to intl::NumberFormat r=gregtatum,tcampbell,anba https://hg.mozilla.org/integration/autoland/rev/abcf774d3b58 Use intl::NumberFormatterSkeleton in PluralRules r=tcampbell https://hg.mozilla.org/integration/autoland/rev/fdf12ac55593 Use intl::NumberFormat in SpiderMonkey r=tcampbell https://hg.mozilla.org/integration/autoland/rev/11f97bc74622 Remove unused unitStyle parameter from intl_FormatNumber r=tcampbell,anba https://hg.mozilla.org/integration/autoland/rev/823ed70ef5fe Add documentation to NumberFormat.h; r=gregtatum,nordzilla https://hg.mozilla.org/integration/autoland/rev/e88dd41c0a90 Add NumberFormat::TryCreate; r=tcampbell
Comment 15•3 years ago
|
||
Backed out 9 changesets (bug 1701695) for causing xpcshell failures in test_messagecontext.js.
https://hg.mozilla.org/integration/autoland/rev/a5ce805152fe2d4a4603eb39121b03c3a1886afd
Push with failures:
https://treeherder.mozilla.org/jobs?repo=autoland&revision=e88dd41c0a9000090b88b332be4af27c94fae9e2&selectedTaskRun=MLSmHXT1QqGN2a1DdBH1JQ.0
Failure log:
https://treeherder.mozilla.org/logviewer?job_id=339378415&repo=autoland&lineNumber=3439
Assignee | ||
Comment 16•3 years ago
|
||
The problem is with these changes: https://phabricator.services.mozilla.com/D112801. I've only seen it on Android so far. The ICU calls seem to all succeed, an Ok() is returned from formatResult(), but on the FluentBundle side it looks we get an Err, and return a nullptr which results in an empty string in Fluent.
Assignee | ||
Comment 17•3 years ago
|
||
Moving the Buffer
definition out of the FluentBuiltInNumberFormatterFormat
fixes things for me locally and on try [1]. I would not have expected that to make a difference, but since this was a change we had planned to make anyway to support DateTimeFormat
, I'll take it.
[1] https://treeherder.mozilla.org/jobs?repo=try&revision=86fa769f5651d4d9b7163532dc8e32af9e5e3ac1
Assignee | ||
Comment 18•3 years ago
|
||
Comment 19•3 years ago
|
||
Pushed by dminor@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/56618c50daff Return std::u16string_view instead of char16_t* in intl::NumberFormat r=gregtatum https://hg.mozilla.org/integration/autoland/rev/e787260f77b9 Rename NumberFormatOptions::CurrencyDisplayStyle; r=gregtatum https://hg.mozilla.org/integration/autoland/rev/f3a30633d181 Restore [[nodiscard]] annotations to NumberFormatterSkeleton; r=gregtatum https://hg.mozilla.org/integration/autoland/rev/1c26ef25db84 Add support for format to parts to intl::NumberFormat r=gregtatum,tcampbell,anba https://hg.mozilla.org/integration/autoland/rev/382a076bc5a0 Use intl::NumberFormatterSkeleton in PluralRules r=tcampbell https://hg.mozilla.org/integration/autoland/rev/da5fdc32ae9b Use intl::NumberFormat in SpiderMonkey r=tcampbell https://hg.mozilla.org/integration/autoland/rev/666e43ab82df Remove unused unitStyle parameter from intl_FormatNumber r=tcampbell,anba https://hg.mozilla.org/integration/autoland/rev/ecd5abbb0ffc Add documentation to NumberFormat.h; r=gregtatum,nordzilla https://hg.mozilla.org/integration/autoland/rev/67f15404db7c Add NumberFormat::TryCreate; r=tcampbell
Comment 20•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/56618c50daff
https://hg.mozilla.org/mozilla-central/rev/e787260f77b9
https://hg.mozilla.org/mozilla-central/rev/f3a30633d181
https://hg.mozilla.org/mozilla-central/rev/1c26ef25db84
https://hg.mozilla.org/mozilla-central/rev/382a076bc5a0
https://hg.mozilla.org/mozilla-central/rev/da5fdc32ae9b
https://hg.mozilla.org/mozilla-central/rev/666e43ab82df
https://hg.mozilla.org/mozilla-central/rev/ecd5abbb0ffc
https://hg.mozilla.org/mozilla-central/rev/67f15404db7c
Updated•3 years ago
|
Description
•