trPluralCases method

String trPluralCases(
  1. Map<PluralCase, String> caseKeys,
  2. int count, [
  3. List<String> args = const []
])

Translates the plural form of this key that matches count, supporting every CLDR plural category — unlike trPlural, which only distinguishes count == 1 from everything else.

caseKeys maps each PluralCase the current language distinguishes to the translation key holding that form. The category for count is resolved through LocalesIntl.pluralResolver (defaulting to the two-form English rule), then the matching key is translated with trArgs and args. When caseKeys has no entry for the resolved category, PluralCase.other is used; when that is also absent, this key itself is translated.

'songs'.trPluralCases({
  PluralCase.one: 'songs_one',
  PluralCase.few: 'songs_few',
  PluralCase.other: 'songs_other',
}, 3, ['3']);

Implementation

String trPluralCases(
  Map<PluralCase, String> caseKeys,
  int count, [
  List<String> args = const [],
]) {
  return _pluralKeyFor(caseKeys, count).trArgs(args);
}