improvements for multiple plural support for translations

- calculate the plural number only if the term has multiple plurals
- only numbers can be converted to absolute values
This commit is contained in:
Mathias Kresin 2015-01-31 08:15:27 +01:00
parent ddcae31d48
commit d2598bac96
1 changed files with 8 additions and 9 deletions

View File

@ -87,17 +87,16 @@ namespace Translator {
$translation = $default;
$plural = 0;
foreach ($values as $value) {
$value = abs($value);
if (is_numeric($value)) {
$plural = (int)$locales['plural']($value);
break;
}
}
if (isset($locales[$identifier])) {
if (is_array($locales[$identifier])) {
foreach ($values as $value) {
if (is_numeric($value)) {
$value = abs($value);
$plural = (int)$locales['plural']($value);
break;
}
}
$translation = $locales[$identifier][$plural];
}
else {