Class PluralRules
Utility class used to determine the plural number to be used for a variable base on the locale.
Namespace: Cake\I18n
Property Summary
-
$_rulesMap protected static
array<string, int>
A map of locale => plurals group used to determine which plural rules apply to the language
Method Summary
-
calculate() public static
Returns the plural form number for the passed locale corresponding to the countable provided in $n.
Method Detail
calculate() ¶ public static
calculate(string $locale, int $n): int
Returns the plural form number for the passed locale corresponding to the countable provided in $n.
Parameters
-
string
$locale The locale to get the rule calculated for.
-
int
$n The number to apply the rules to.
Returns
int
Links
http://localization-guide.readthedocs.org/en/latest/l10n/pluralforms.html
https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals#List_of_Plural_Rules
https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals#List_of_Plural_Rules
Property Detail
$_rulesMap ¶ protected static
A map of locale => plurals group used to determine which plural rules apply to the language
Type
array<string, int>