W3cubDocs

/CakePHP 4.4

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

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>

© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.I18n.PluralRules.html