You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support for explicit 0 and 1 rules for number formatting #21
Some types of CLDR data (such as unitPatterns and currency displayNames) allow specification
of plural rules for explicit cases “0” and “1”, in addition to the language-specific plural cases specified
above: “zero”, “one”, “two” ... “other”:
- The explicit “0” and “1” cases are not defined by language-specific rules, and are available in any
language for the CLDR data items that accept them.
- The explicit “0” and “1” cases apply to the exact numeric values 0 and 1 respectively. These cases
are typically used for plurals of items that do not have fractional value, like books or files.
- The explicit “0” and “1” cases have precedence over the “zero” and “one” cases. For example, if
for a particular element CLDR data includes values for both the “1” and “one” cases, then the “1”
value is used for numeric values of exactly 1, while the “one” value is used for any other formatted
numeric values matching the “one” plural rule for the language.
I am not sure I understand this correctly, but this is quoting the LDML rules for CLDR data - intl supports the ICU MessageFormat, which explicitly states
Note: In a plural argument like in the example above, if the English message has both =0 and =1 (up to =offset+1) then it does not need a “one” variant because that would never be selected. It does always need an “other” variant.
Also, while =1 and one are semantically different, there is are no differences in the result. The only benefit I see is the ease of use for translators, who may be used to one, two etc. Am I missing something?
See #215 , although that's also
talking about formatting of the plural parameter.
These can have different semantics. =1 means exactly one. 'one', means
singular, which can be different, with Russian as a particularly tricky
example. And they also mention formatting fractional values as plurals,
though I don't think this package really supports that. The handling of
this is confusing, since we have named parameters zero/one, but emit =0 and
=1. On parsing, I think we treat them specially as well, though the details
are fuzzy. But it's a long-standing pain point.
Activity
mosuem commentedon Oct 20, 2022
I am not sure I understand this correctly, but this is quoting the LDML rules for CLDR data -
intlsupports the ICU MessageFormat, which explicitly statesAlso, while
=1andoneare semantically different, there is are no differences in the result. The only benefit I see is the ease of use for translators, who may be used toone,twoetc. Am I missing something?alan-knight commentedon Oct 20, 2022