Missing rounding mode in internal UNumberFormat in Intl.PluralRules?
Categories
(Core :: JavaScript: Internationalization API, defect, P2)
Tracking
()
People
(Reporter: anba, Assigned: anba)
Details
Attachments
(1 file)
new Intl.PluralRules("en", {maximumFractionDigits:0}).select(0.5)
currently returns "other". But given that new Intl.NumberFormat("en", {maximumFractionDigits:0}).format(0.5)
returns "1", is the correct result actually "one"?
Also compare, new Intl.PluralRules("en", {maximumFractionDigits:0}).select(0)
returns "other", whereas new Intl.PluralRules("en", {maximumFractionDigits:0}).select(1)
returns "one".
https://tc39.github.io/ecma402/#sec-pluralruleselect doesn't describe if n
or operands
should be used to select the correct plural representation:
When the PluralRuleSelect abstract operation is called with four arguments, it performs an implementation-dependent algorithm to map n to the appropriate plural representation of the Plural Rules Operands Record operands by selecting the rules denoted by type for the corresponding locale, or the String value "other".
Comment 1•5 years ago
|
||
So, seems like we respect minimumFractionDigits
, but not maximumFractionDigits
? :)
new Intl.PluralRules("en", {minimumFractionDigits:0}).select(1) // one
new Intl.PluralRules("en", {minimumFractionDigits:1}).select(1) // other
I'd say we should respect maximum as well.
Comment 2•5 years ago
|
||
The priority flag is not set for this bug.
:Waldo, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 3•5 years ago
|
||
Yeah, I'm inclined to say we should be doing round-to-nearest-even everywhere. PluralRules
delegates a bunch of stuff to NumberFormat
handling already, and this seems like the sort of thing where the algorithm should be following suit.
Updated•5 years ago
|
Assignee | ||
Comment 4•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 5•5 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=427b008b06263ea278b38a8b40bfd359e34d1436
Pushed by dvarga@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/79e15e776159
Add missing rounding-mode to Intl.PluralRules. r=jwalden
Comment 7•5 years ago
|
||
bugherder |
Comment 8•5 years ago
|
||
Since the status are different for nightly and release, what's the status for beta?
For more information, please visit auto_nag documentation.
Updated•5 years ago
|
Description
•