Update RU pluralization to use 3 keys: one, few, other (as by Transifex)

This commit is contained in:
Anton Andriyevskyy
2014-08-23 15:28:14 +03:00
parent 76824cda31
commit c42a5551a1
3 changed files with 9 additions and 13 deletions

View File

@ -1,14 +1,11 @@
MessageFormat.locale.ru = function (n) {
if ((n % 10) == 1 && (n % 100) != 11) {
var r10 = n % 10, r100 = n % 100;
if (r10 == 1 && r100 != 11)
return 'one';
}
if ((n % 10) >= 2 && (n % 10) <= 4 &&
((n % 100) < 12 || (n % 100) > 14) && n == Math.floor(n)) {
if (r10 >= 2 && r10 <= 4 && (r100 < 12 || r100 > 14) && n == Math.floor(n))
return 'few';
}
if ((n % 10) === 0 || ((n % 10) >= 5 && (n % 10) <= 9) ||
((n % 100) >= 11 && (n % 100) <= 14) && n == Math.floor(n)) {
return 'many';
}
return 'other';
};