PluralRules Fails To Construct For Some Locales #852
Labels
C-pluralrules
Component: Plural rules
duplicate
This issue or pull request already exists
T-core
Type: Required functionality
Our current implementation of PluralRules fails to construct from a locale if the ID does not exactly match one of the IDs in plurals.json or ordinals.json.
This means, for example, that constructing a PluralRules object from
en
is fine, but constructing one fromen-US
fails.ICU4C is able to retrieve the
en
PluralRules when provided theen-US
locale.ICU4C also has the behavior of constructing a default PluralRules object for any valid locale, even if it cannot resolve specific rules. In this event, it creates a default object whose only plural category is "other". One example of this is ordinal rules for
br
, which do not exist inordinals.json
.We should decide how we want to handle this in ICU4X. I see three options:
Keep things the way they are. You must construct a PluralRules object with the exact lang-id that is in CLDR.
Attempt to resolve the correct langid from the locale, e.g.
en
fromen-US
, but continue to return an error on construction for locales that have no rules, such asbr
ordinals.Do what ICU4C does and attempt to resolve specific rules from a locale, but otherwise construct a PluralRules object that defaults to "other" as the only category.
I think that 1) provides a needlessly complex user experience. I have not decided yet about whether I prefer option 2) or option 3).
The text was updated successfully, but these errors were encountered: