-
-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plurals does not support zero e.g. for en #696
Comments
Did you set
|
Interesting... The documentation for that field is this: /// Ignore usage of plural strings for languages that do not use plural rules.
/// @Default value false
/// Example:
/// ```
/// // Default behavior, use "zero" rule for 0 even if the language doesn't
/// // use it by default (e.g. "en"). If "zero" localization for that string
/// // doesn't exist, "other" is still used as fallback.
/// // "nTimes": "{count, plural, =0{never} =1{once} other{{count} times}}"
/// // Text(AppLocalizations.of(context)!.nTimes(_counter)),
/// // will print "never, once, 2 times" for ALL languages.
/// ignorePluralRules: true
/// // Use "zero" rule for 0 only if the language is set to do so (e.g. for
/// "lt" but not for "en").
/// // "nTimes": "{count, plural, =0{never} =1{once} other{{count} times}}"
/// // Text(AppLocalizations.of(context)!.nTimes(_counter)),
/// // will print "never, once, 2 times" ONLY for languages with plural rules.
/// ignorePluralRules: false
/// ```
final bool ignorePluralRules; But the constructor is this: EasyLocalization({
//...
this.ignorePluralRules = true,
//...
}) That does not make sense. I'll check that later again. By the way @petodavid do you know if this flag breaks languages with multiple plural forms? |
You should expect no braking change in case you handle the rule cases (ZERO, ONE, TWO, FEW, MANY, OTHER), this depends on the language and not all languages are using all theses cases. For example in English we have ONE and OTHER. Here you can find all the rules: Rules. Rule for English is this:
|
I am aware that there is no official zero case for the English language and that the default other is technically correct, but supporting the zero case would be nice to handle empty states.
As sample you can use the money example from the readme:
When I use
'money'.plurals(0, args: [0])
I get the unexpected output: 'You have 0 dollars'. Expected would be 'You not have money'.The text was updated successfully, but these errors were encountered: