Kaynağa Gözat

Fixed broken lithuanian translation

This closes https://github.com/select2/select2/issues/4301.

Signed-off-by: Kevin Brown <[email protected]>
Aurelijus Rožėnas 9 yıl önce
ebeveyn
işleme
5b5eddd183
1 değiştirilmiş dosya ile 10 ekleme ve 12 silme
  1. 10 12
      src/js/select2/i18n/lt.js

+ 10 - 12
src/js/select2/i18n/lt.js

@@ -1,14 +1,12 @@
 define(function () {
-  // Italian
-  function ending (count, first, second, third) {
-    if ((count % 100 > 9 && count % 100 < 21) || count % 10 === 0) {
-      if (count % 10 > 1) {
-        return second;
-      } else {
-        return third;
-      }
+  // rules from http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html#lt
+  function ending(count, one, few, other) {
+    if (count % 10 === 1 && (count % 100 < 11 || count % 100 > 19)) {
+      return one;
+    } else if ((count % 10 >= 2 && count % 10 <= 9) && (count % 100 < 11 || count % 100 > 19)) {
+      return few;
     } else {
-      return first;
+      return other;
     }
   }
 
@@ -18,7 +16,7 @@ define(function () {
 
       var message = 'Pašalinkite ' + overChars + ' simbol';
 
-      message += ending(overChars, 'ių', 'ius', 'į');
+      message += ending(overChars, 'į', 'ius', 'ių');
 
       return message;
     },
@@ -27,7 +25,7 @@ define(function () {
 
       var message = 'Įrašykite dar ' + remainingChars + ' simbol';
 
-      message += ending(remainingChars, 'ių', 'ius', 'į');
+      message += ending(remainingChars, 'į', 'ius', 'ių');
 
       return message;
     },
@@ -37,7 +35,7 @@ define(function () {
     maximumSelected: function (args) {
       var message = 'Jūs galite pasirinkti tik ' + args.maximum + ' element';
 
-      message += ending(args.maximum, 'ų', 'us', 'ą');
+      message += ending(args.maximum, 'ą', 'us', 'ų');
 
       return message;
     },