Definition at line 30 of file Plural.php.
◆ getPlural()
static getPlural |
( |
|
$number, |
|
|
|
$locale |
|
) |
| |
|
static |
Returns the plural definition to use
- Parameters
-
integer | $number | Number for plural selection |
string | $locale | Locale to use |
- Returns
- integer Plural number to use
Definition at line 46 of file Plural.php.
48 if ($locale ==
"pt_BR") {
53 if (strlen($locale) > 3) {
54 $locale = substr($locale, 0, -strlen(strrchr($locale,
'_')));
57 if (isset(self::$_plural[$locale])) {
60 if (!is_int($return) || ($return < 0)) {
174 return (
$number % 10 == 1) ? 0 : 1;
call_user_func($callable, $param)
◆ setPlural()
static setPlural |
( |
|
$rule, |
|
|
|
$locale |
|
) |
| |
|
static |
Set's a new plural rule
- Parameters
-
string | $rule | Callback which acts as rule |
string | $locale | Locale which is used for this callback |
- Returns
- null
Definition at line 206 of file Plural.php.
208 if ($locale ==
"pt_BR") {
213 if (strlen($locale) > 3) {
214 $locale = substr($locale, 0, -strlen(strrchr($locale,
'_')));
217 if (!is_callable(
$rule)) {
218 #require_once 'Zend/Translate/Exception.php'; 222 self::$_plural[$locale] =
$rule;
◆ $_plural
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Translate/Plural.php