Plural categories don't work as they should
Hi! Plurals don't work as expected, I'm not sure about all cases, but here's my example:
{
"view_count": {
"one": "{} view",
"other": "{} views"
}
}
As you can see, I provided all plural categories for English (according to 2nd source), but for some reason, easy_localization tries to use the zero category as well for a value of 0.
[🌎 Easy Localization] [WARNING] Localization key [view_count.zero] not found<…>
[🌎 Easy Localization] [WARNING] Fallback localization key [view_count.zero] not found<…>
Other than that, the library serves me well, but this bug is really annoying because my translation service allows translating only the plural categories a given language uses (so for English that's only one and other).
Cause
This is most likely due to:
https://github.com/aissat/easy_localization/blob/f4f3ce803a38f78316af1fa57dd91484a8bd6494/lib/src/localization.dart#L121-L130
I believe this was to mimic the behavior of =0, =1 or =2 from the ICU plurals syntax (3rd source), but this should fall back to the ordinary plural categories. And not use the same name as the zero, one or two plural categories, as one might want to have a specific string set for a value of 1, but for example, one category in Ukrainian is also used for 21, 31, 41...
Sources
- http://cldr.unicode.org/index/cldr-spec/plural-rules
- https://unicode-org.github.io/cldr-staging/charts/37/supplemental/language_plural_rules.html
- https://unicode-org.github.io/icu/userguide/format_parse/messages/#complex-argument-types
Related
- #352
Waiting for this fix. I can't release my app without this fix.
Hello, is there a progress on this issue?
It has been fixed and merged, but still not released
Any updates?
Looks like it has been released with 3.0.1-dev