Skip to content

Commit 5b5eddd

Browse files
aurelijusrozenaskevin-brown
authored andcommitted
Fixed broken lithuanian translation
This closes select2#4301. Signed-off-by: Kevin Brown <kevin@kevin-brown.com>
1 parent 5a831af commit 5b5eddd

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

src/js/select2/i18n/lt.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
define(function () {
2-
// Italian
3-
function ending (count, first, second, third) {
4-
if ((count % 100 > 9 && count % 100 < 21) || count % 10 === 0) {
5-
if (count % 10 > 1) {
6-
return second;
7-
} else {
8-
return third;
9-
}
2+
// rules from http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html#lt
3+
function ending(count, one, few, other) {
4+
if (count % 10 === 1 && (count % 100 < 11 || count % 100 > 19)) {
5+
return one;
6+
} else if ((count % 10 >= 2 && count % 10 <= 9) && (count % 100 < 11 || count % 100 > 19)) {
7+
return few;
108
} else {
11-
return first;
9+
return other;
1210
}
1311
}
1412

@@ -18,7 +16,7 @@ define(function () {
1816

1917
var message = 'Pašalinkite ' + overChars + ' simbol';
2018

21-
message += ending(overChars, '', 'ius', 'į');
19+
message += ending(overChars, 'į', 'ius', '');
2220

2321
return message;
2422
},
@@ -27,7 +25,7 @@ define(function () {
2725

2826
var message = 'Įrašykite dar ' + remainingChars + ' simbol';
2927

30-
message += ending(remainingChars, '', 'ius', 'į');
28+
message += ending(remainingChars, 'į', 'ius', '');
3129

3230
return message;
3331
},
@@ -37,7 +35,7 @@ define(function () {
3735
maximumSelected: function (args) {
3836
var message = 'Jūs galite pasirinkti tik ' + args.maximum + ' element';
3937

40-
message += ending(args.maximum, 'ų', 'us', 'ą');
38+
message += ending(args.maximum, 'ą', 'us', 'ų');
4139

4240
return message;
4341
},

0 commit comments

Comments
 (0)