pluralSelectorBody method

Code pluralSelectorBody()

Implementation

Code pluralSelectorBody() {
  return switch (options.pluralSelector) {
    PluralSelectorType.intl => const Code('''
return Intl.pluralLogic(
  howMany,
  few: few,
  many: many,
  zero: numberCases?[0] ?? wordCases?[0],
  one: numberCases?[1] ?? wordCases?[1],
  two: numberCases?[2] ?? wordCases?[2],
  other: other,
  locale: currentLocale,
);
'''),
    PluralSelectorType.intl4x => const Code('''
Message getCase(int i) => numberCases?[i] ?? wordCases?[i] ?? other;
  return switch (Intl(locale: Locale.parse(currentLocale)).plural().select(howMany)) {
    PluralCategory.zero => getCase(0),
    PluralCategory.one => getCase(1),
    PluralCategory.two => getCase(2),
    PluralCategory.few => few ?? other,
    PluralCategory.many => many ?? other,
    PluralCategory.other => other,
  };
  '''),
    PluralSelectorType.custom => throw ArgumentError(),
  };
}