public static function PluralizationRules::set in Plug 7
Overrides the default plural rule for a given locale.
Parameters
string $rule A PHP callable:
string $locale The locale:
Throws
\LogicException
File
- lib/
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;
}