Browse Source

Lithuanian l10n improved

Uriy Efremochkin 11 years ago
parent
commit
daea53193e
1 changed files with 10 additions and 15 deletions
  1. 10 15
      select2_locale_lt.js

+ 10 - 15
select2_locale_lt.js

@@ -1,29 +1,24 @@
 /**
 /**
- * Select2 lithuanian translation.
+ * Select2 Lithuanian translation.
  * 
  * 
- * Author: CRONUS Karmalakas <cronus dot karmalakas at gmail dot com>
+ * @author  CRONUS Karmalakas <cronus dot karmalakas at gmail dot com>
+ * @author  Uriy Efremochkin <[email protected]>
  */
  */
 (function ($) {
 (function ($) {
     "use strict";
     "use strict";
 
 
     $.extend($.fn.select2.defaults, {
     $.extend($.fn.select2.defaults, {
         formatNoMatches: function () { return "Atitikmenų nerasta"; },
         formatNoMatches: function () { return "Atitikmenų nerasta"; },
-        formatInputTooShort: function (input, min) {
-        	var n = min - input.length,
-        	    suffix = (n % 10 == 1) && (n % 100 != 11) ? 'į' : (((n % 10 >= 2) && ((n % 100 < 10) || (n % 100 >= 20))) ? 'ius' : 'ių');
-        	return "Įrašykite dar " + n + " simbol" + suffix;
-        },
-        formatInputTooLong: function (input, max) {
-        	var n = input.length - max,
-        	    suffix = (n % 10 == 1) && (n % 100 != 11) ? 'į' : (((n % 10 >= 2) && ((n % 100 < 10) || (n % 100 >= 20))) ? 'ius' : 'ių');
-        	return "Pašalinkite " + n + " simbol" + suffix;
-        },
+        formatInputTooShort: function (input, min) { return "Įrašykite dar" + character(min - input.length); },
+        formatInputTooLong: function (input, max) { return "Pašalinkite" + character(input.length - max); },
         formatSelectionTooBig: function (limit) {
         formatSelectionTooBig: function (limit) {
-        	var n = limit,
-                suffix = (n % 10 == 1) && (n % 100 != 11) ? 'ą' : (((n % 10 >= 2) && ((n % 100 < 10) || (n % 100 >= 20))) ? 'us' : 'ų');
-        	return "Jūs galite pasirinkti tik " + limit + " element" + suffix;
+        	return "Jūs galite pasirinkti tik " + limit + " element" + ((limit%100 > 9 && limit%100 < 21) || limit%10 == 0 ? "ų" : limit%10 > 1 ? "us" : "ą");
         },
         },
         formatLoadMore: function (pageNumber) { return "Kraunama daugiau rezultatų..."; },
         formatLoadMore: function (pageNumber) { return "Kraunama daugiau rezultatų..."; },
         formatSearching: function () { return "Ieškoma..."; }
         formatSearching: function () { return "Ieškoma..."; }
     });
     });
+
+    function character (n) {
+        return " " + n + " simbol" + ((n%100 > 9 && n%100 < 21) || n%10 == 0 ? "ių" : n%10 > 1 ? "ius" : "į");
+    }
 })(jQuery);
 })(jQuery);