public static function PluralizationRules::set in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/translation/PluralizationRules.php \Symfony\Component\Translation\PluralizationRules::set()
Overrides the default plural rule for a given locale.
Parameters
callable $rule A PHP callable:
string $locale The locale:
Throws
\LogicException
File
- vendor/
symfony/ translation/ PluralizationRules.php, line 197
Class
- PluralizationRules
- Returns the plural rules for a given locale.
Namespace
Symfony\Component\TranslationCode
public static function set($rule, $locale) {
if ('pt_BR' === $locale) {
// temporary set a locale for brazilian
$locale = 'xbr';
}
if (strlen($locale) > 3) {
$locale = substr($locale, 0, -strlen(strrchr($locale, '_')));
}
if (!is_callable($rule)) {
throw new \LogicException('The given rule can not be called');
}
self::$rules[$locale] = $rule;
}