Those particular strings are in fact incorrect.
The correct strings for above translation with regards to the formula present in Plural-Forms header for russian language would be
Code:
msgstr[0] "просмотр"
msgstr[1] "просмотра"
msgstr[2] "просмотров"
msgstr[3] "not used"
But those forms I can fix myself through translation site(in fact I just did
).
What I can't fix is that in Russian language plural forms are not as easy as 0->one, 1->few, 2->many.
Its more like
msgstr[0] for 0, 1, 21, 31, 41, ... etc - not only for 1 but for also for numbers ending with 1
msgstr[1] for 2, 3, 4, 22, 23, 24, 32, 33, 34 ... etc. - basicaly for numbers ending with 2, 3 and 4
msgstr[2] for every other cases including 0(zero)
Try to execute
this little program that I wrote and see how plural forms should generate in Russian for yourself.
So the major issue is not with incorrect order of string which can be easily fixed through translation interface,
but with plural picking algorithm itself as it ignores correct formula present in po files.
For example, current gettext library returns msgstr[1] for numbers 3, 4 which is incorrect and msgstr[2] for 21 which is also incorrect.
And russian isn't even the only language that uses different expression for generation plural forms.
Check out this table
http://docs.translatehouse.org/proj...est/l10n/pluralforms.html?id=l10n/pluralforms.
Modifed version on the other hand parses correct expression from po header and creates plural-form-picking function based on said expression.
What's awsome about it is that it's fast because it uses create_function only once during the lifetime of gettext object and
pretty secure as header is filtered by regular expression that restricts characters used in the expression to 0-9, n, %, &, !, ?, (, >, = , <, \ , ) ,\ , : and |
PHP:
/**
* Parse a number of forms and expression value from headers
*
* @return Array with number of forms and expression
*/
private function parsePlurals() {
if ( preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*([0-9n%&!?\(>=<\)\\:|; ]+)$/', $this->headerTable['Plural-Forms'], $matches) ) {
$nplurals = (int)$matches[1];
$expression = trim( $this->parenthesizePluralExpression($matches[2]) );
return array($nplurals, $expression);
}
return array(2, 'n != 1'); // Fallback to two forms for 'one' and 'many'.
}
/**
* Create function to evaluate plural expression and call it
*
* @param Integer $count The number for plural form.
*
* @return Integer Index of plural form for translation array
*/
private function selectPluralForm($count) {
if ( is_null($this->_selectPluralForm) ) {
list( $nplurals, $expression ) = $this->parsePlurals();
$expression = str_replace('n', '$n', $expression);
$func = "\$index = (int)($expression); return (\$index < $nplurals)? \$index : $nplurals - 1;";
$this->_selectPluralForm = create_function('$n', $func);
}
return call_user_func($this->_selectPluralForm, $count);
}
Sorry if I wasn't as clear as I would liked.
Explaining languages is quite difficult and it's super late here which is also not helping.
Hope you understand.