0

I'm having the below pluralSample string in my app_en.arb file, based on the passed option we can pick the value

    "pluralSample" : "{count, plural, =0{no persons} =1{one person} =2{2 persons} few{few persons} many{many persons} other{{count} people}}",

By passing 0 to setter we can get no persons value

 Text(AppLocalizations.of(context)!.pluralSample(0)) /// no persons

By passing count I can get 25 people

 Text(AppLocalizations.of(context)!.pluralSample(25)) /// 25 people

But how can we access these few and many options here?

few{few persons} many{many persons} 
krishnaji
  • 1,605
  • 4
  • 14
  • 25

1 Answers1

0

https://cldr.unicode.org/index/cldr-spec/plural-rules

These are the rules mentioned and used for while specifying few, many, one. They depend on language. The Plural Method comes from https://pub.dev/documentation/intl/latest/intl/Intl/plural.html

intl library and you can read it.

Here is the code that describes when Few and Many are returned varies for different language codes. https://github.com/dart-lang/i18n/blob/main/pkgs/intl/lib/src/plural_rules.dart#L37

For English-IN,US only One and Others get triggered.

Krish Bhanushali
  • 1,594
  • 1
  • 8
  • 16