From 837715f9391a493a53446dbed411b727cb788e96 Mon Sep 17 00:00:00 2001 From: Jonas Pyfferoen Date: Tue, 15 Apr 2014 09:20:22 +0200 Subject: [PATCH] Fixes #2278 Instead of instantly applying the translations, add them to an array. That way users can include the language files that their site supports and apply the required language using $.extend($.fn.select2.defaults, $.fn.select2.locales["nl"]); Signed-off-by: Kevin Brown --- select2.js | 23 +++++++++++++++-------- select2_locale_ar.js | 2 +- select2_locale_bg.js | 2 +- select2_locale_ca.js | 2 +- select2_locale_cs.js | 2 +- select2_locale_da.js | 2 +- select2_locale_de.js | 2 +- select2_locale_el.js | 2 +- select2_locale_en.js.template | 2 +- select2_locale_es.js | 2 +- select2_locale_et.js | 2 +- select2_locale_eu.js | 2 +- select2_locale_fa.js | 2 +- select2_locale_fi.js | 2 +- select2_locale_fr.js | 2 +- select2_locale_gl.js | 2 +- select2_locale_he.js | 2 +- select2_locale_hr.js | 2 +- select2_locale_hu.js | 2 +- select2_locale_id.js | 2 +- select2_locale_is.js | 2 +- select2_locale_it.js | 2 +- select2_locale_ja.js | 2 +- select2_locale_ka.js | 2 +- select2_locale_ko.js | 2 +- select2_locale_lt.js | 2 +- select2_locale_lv.js | 2 +- select2_locale_mk.js | 2 +- select2_locale_ms.js | 2 +- select2_locale_nl.js | 2 +- select2_locale_no.js | 2 +- select2_locale_pl.js | 2 +- select2_locale_pt-BR.js | 2 +- select2_locale_pt-PT.js | 2 +- select2_locale_ro.js | 2 +- select2_locale_rs.js | 2 +- select2_locale_ru.js | 2 +- select2_locale_sk.js | 2 +- select2_locale_sv.js | 2 +- select2_locale_th.js | 2 +- select2_locale_tr.js | 2 +- select2_locale_uk.js | 2 +- select2_locale_vi.js | 2 +- select2_locale_zh-CN.js | 2 +- select2_locale_zh-TW.js | 2 +- 45 files changed, 59 insertions(+), 52 deletions(-) diff --git a/select2.js b/select2.js index 2320df74..fa4d21a7 100644 --- a/select2.js +++ b/select2.js @@ -3425,14 +3425,6 @@ the specific language governing permissions and limitations under the Apache Lic }, formatResultCssClass: function(data) {return data.css;}, formatSelectionCssClass: function(data, container) {return undefined;}, - formatMatches: function (matches) { if (matches === 1) { return "One result is available, press enter to select it."; } return matches + " results are available, use up and down arrow keys to navigate."; }, - formatNoMatches: function () { return "No matches found"; }, - formatAjaxError: function (jqXHR, textStatus, errorThrown) { return "Loading failed"; }, - formatInputTooShort: function (input, min) { var n = min - input.length; return "Please enter " + n + " or more character" + (n == 1? "" : "s"); }, - formatInputTooLong: function (input, max) { var n = input.length - max; return "Please delete " + n + " character" + (n == 1? "" : "s"); }, - formatSelectionTooBig: function (limit) { return "You can only select " + limit + " item" + (limit == 1 ? "" : "s"); }, - formatLoadMore: function (pageNumber) { return "Loading more results…"; }, - formatSearching: function () { return "Searching…"; }, minimumResultsForSearch: 0, minimumInputLength: 0, maximumInputLength: null, @@ -3471,6 +3463,21 @@ the specific language governing permissions and limitations under the Apache Lic } }; + $.fn.select2.locales = []; + + $.fn.select2.locales['en'] = { + formatMatches: function (matches) { if (matches === 1) { return "One result is available, press enter to select it."; } return matches + " results are available, use up and down arrow keys to navigate."; }, + formatNoMatches: function () { return "No matches found"; }, + formatAjaxError: function (jqXHR, textStatus, errorThrown) { return "Loading failed"; }, + formatInputTooShort: function (input, min) { var n = min - input.length; return "Please enter " + n + " or more character" + (n == 1 ? "" : "s"); }, + formatInputTooLong: function (input, max) { var n = input.length - max; return "Please delete " + n + " character" + (n == 1 ? "" : "s"); }, + formatSelectionTooBig: function (limit) { return "You can only select " + limit + " item" + (limit == 1 ? "" : "s"); }, + formatLoadMore: function (pageNumber) { return "Loading more results…"; }, + formatSearching: function () { return "Searching…"; }, + }; + + $.extend($.fn.select2.defaults, $.fn.select2.locales['en']); + $.fn.select2.ajaxDefaults = { transport: $.ajax, params: { diff --git a/select2_locale_ar.js b/select2_locale_ar.js index acb33a2f..bdc19c95 100644 --- a/select2_locale_ar.js +++ b/select2_locale_ar.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['ar'] = { formatNoMatches: function () { return "لم يتم العثور على مطابقات"; }, formatInputTooShort: function (input, min) { var n = min - input.length; if (n == 1){ return "الرجاء إدخال حرف واحد على الأكثر"; } return n == 2 ? "الرجاء إدخال حرفين على الأكثر" : "الرجاء إدخال " + n + " على الأكثر"; }, formatInputTooLong: function (input, max) { var n = input.length - max; if (n == 1){ return "الرجاء إدخال حرف واحد على الأقل"; } return n == 2 ? "الرجاء إدخال حرفين على الأقل" : "الرجاء إدخال " + n + " على الأقل "; }, diff --git a/select2_locale_bg.js b/select2_locale_bg.js index 585d28a2..360ed07b 100644 --- a/select2_locale_bg.js +++ b/select2_locale_bg.js @@ -7,7 +7,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['bg'] = { formatNoMatches: function () { return "Няма намерени съвпадения"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Моля въведете още " + n + " символ" + (n > 1 ? "а" : ""); }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Моля въведете с " + n + " по-малко символ" + (n > 1 ? "а" : ""); }, diff --git a/select2_locale_ca.js b/select2_locale_ca.js index 7e19d3ce..3a288fdc 100644 --- a/select2_locale_ca.js +++ b/select2_locale_ca.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['ca'] = { formatNoMatches: function () { return "No s'ha trobat cap coincidència"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Introduïu " + n + " caràcter" + (n == 1 ? "" : "s") + " més"; }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Introduïu " + n + " caràcter" + (n == 1? "" : "s") + "menys"; }, diff --git a/select2_locale_cs.js b/select2_locale_cs.js index 376b54a1..d36e45da 100644 --- a/select2_locale_cs.js +++ b/select2_locale_cs.js @@ -12,7 +12,7 @@ 3: function() { return "tři"; }, 4: function() { return "čtyři"; } } - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['cs'] = { formatNoMatches: function () { return "Nenalezeny žádné položky"; }, formatInputTooShort: function (input, min) { var n = min - input.length; diff --git a/select2_locale_da.js b/select2_locale_da.js index dbce3e17..d67c445f 100644 --- a/select2_locale_da.js +++ b/select2_locale_da.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['da'] = { formatNoMatches: function () { return "Ingen resultater fundet"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Angiv venligst " + n + " tegn mere"; }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Angiv venligst " + n + " tegn mindre"; }, diff --git a/select2_locale_de.js b/select2_locale_de.js index ee971ac4..5e41f36b 100644 --- a/select2_locale_de.js +++ b/select2_locale_de.js @@ -4,7 +4,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['de'] = { formatNoMatches: function () { return "Keine Übereinstimmungen gefunden"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Bitte " + n + " Zeichen mehr eingeben"; }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Bitte " + n + " Zeichen weniger eingeben"; }, diff --git a/select2_locale_el.js b/select2_locale_el.js index e94b02cb..a5d8fed1 100644 --- a/select2_locale_el.js +++ b/select2_locale_el.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['el'] = { formatNoMatches: function () { return "Δεν βρέθηκαν αποτελέσματα"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Παρακαλούμε εισάγετε " + n + " περισσότερο" + (n > 1 ? "υς" : "") + " χαρακτήρ" + (n > 1 ? "ες" : "α"); }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Παρακαλούμε διαγράψτε " + n + " χαρακτήρ" + (n > 1 ? "ες" : "α"); }, diff --git a/select2_locale_en.js.template b/select2_locale_en.js.template index 9a65edd6..adf3d19f 100644 --- a/select2_locale_en.js.template +++ b/select2_locale_en.js.template @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['en'] = { formatMatches: function (matches) { if (matches === 1) { return "One result is available, press enter to select it."; } return matches + " results are available, use up and down arrow keys to navigate."; }, formatNoMatches: function () { return "No matches found"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Please enter " + n + " or more character" + (n == 1 ? "" : "s"); }, diff --git a/select2_locale_es.js b/select2_locale_es.js index f2b58179..15d515d3 100644 --- a/select2_locale_es.js +++ b/select2_locale_es.js @@ -4,7 +4,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['es'] = { formatNoMatches: function () { return "No se encontraron resultados"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Por favor, introduzca " + n + " car" + (n == 1? "ácter" : "acteres"); }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Por favor, elimine " + n + " car" + (n == 1? "ácter" : "acteres"); }, diff --git a/select2_locale_et.js b/select2_locale_et.js index a4045d22..4a9bc36c 100644 --- a/select2_locale_et.js +++ b/select2_locale_et.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['et'] = { formatNoMatches: function () { return "Tulemused puuduvad"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Sisesta " + n + " täht" + (n == 1 ? "" : "e") + " rohkem"; }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Sisesta " + n + " täht" + (n == 1? "" : "e") + " vähem"; }, diff --git a/select2_locale_eu.js b/select2_locale_eu.js index 1da1a709..4e8873fa 100644 --- a/select2_locale_eu.js +++ b/select2_locale_eu.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['eu'] = { formatNoMatches: function () { return "Ez da bat datorrenik aurkitu"; }, diff --git a/select2_locale_fa.js b/select2_locale_fa.js index a9e95af4..6ffbde32 100644 --- a/select2_locale_fa.js +++ b/select2_locale_fa.js @@ -7,7 +7,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['fa'] = { formatMatches: function (matches) { return matches + " نتیجه موجود است، کلیدهای جهت بالا و پایین را برای گشتن استفاده کنید."; }, formatNoMatches: function () { return "نتیجه‌ای یافت نشد."; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "لطفاً " + n + " نویسه بیشتر وارد نمایید"; }, diff --git a/select2_locale_fi.js b/select2_locale_fi.js index 9bed310f..e67407cc 100644 --- a/select2_locale_fi.js +++ b/select2_locale_fi.js @@ -3,7 +3,7 @@ */ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['fi'] = { formatNoMatches: function () { return "Ei tuloksia"; }, diff --git a/select2_locale_fr.js b/select2_locale_fr.js index 110854f8..a9711d47 100644 --- a/select2_locale_fr.js +++ b/select2_locale_fr.js @@ -4,7 +4,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['fr'] = { formatMatches: function (matches) { return matches + " résultats sont disponibles, utilisez les flèches haut et bas pour naviguer."; }, formatNoMatches: function () { return "Aucun résultat trouvé"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Saisissez " + n + " caractère" + (n == 1? "" : "s") + " supplémentaire" + (n == 1? "" : "s") ; }, diff --git a/select2_locale_gl.js b/select2_locale_gl.js index 80326320..252fb112 100644 --- a/select2_locale_gl.js +++ b/select2_locale_gl.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['gl'] = { formatNoMatches: function () { return "Non se atoparon resultados"; }, diff --git a/select2_locale_he.js b/select2_locale_he.js index 00385410..e34ab0b4 100644 --- a/select2_locale_he.js +++ b/select2_locale_he.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['he'] = { formatNoMatches: function () { return "לא נמצאו התאמות"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "נא להזין עוד " + n + " תווים נוספים"; }, formatInputTooLong: function (input, max) { var n = input.length - max; return "נא להזין פחות " + n + " תווים"; }, diff --git a/select2_locale_hr.js b/select2_locale_hr.js index c2937252..1bc19f63 100644 --- a/select2_locale_hr.js +++ b/select2_locale_hr.js @@ -7,7 +7,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['hr'] = { formatNoMatches: function () { return "Nema rezultata"; }, formatInputTooShort: function (input, min) { return "Unesite još" + character(min - input.length); }, formatInputTooLong: function (input, max) { return "Unesite" + character(input.length - max) + " manje"; }, diff --git a/select2_locale_hu.js b/select2_locale_hu.js index a8c30881..69faa999 100644 --- a/select2_locale_hu.js +++ b/select2_locale_hu.js @@ -4,7 +4,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['hu'] = { formatNoMatches: function () { return "Nincs találat."; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Túl rövid. Még " + n + " karakter hiányzik."; }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Túl hosszú. " + n + " karakterrel több, mint kellene."; }, diff --git a/select2_locale_id.js b/select2_locale_id.js index 54745407..243f8cf3 100644 --- a/select2_locale_id.js +++ b/select2_locale_id.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['id'] = { formatNoMatches: function () { return "Tidak ada data yang sesuai"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Masukkan " + n + " huruf lagi" + (n == 1 ? "" : "s"); }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Hapus " + n + " huruf" + (n == 1 ? "" : "s"); }, diff --git a/select2_locale_is.js b/select2_locale_is.js index aecc6cd7..79778d08 100644 --- a/select2_locale_is.js +++ b/select2_locale_is.js @@ -4,7 +4,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['is'] = { formatNoMatches: function () { return "Ekkert fannst"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Vinsamlegast skrifið " + n + " staf" + (n > 1 ? "i" : "") + " í viðbót"; }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Vinsamlegast styttið texta um " + n + " staf" + (n > 1 ? "i" : ""); }, diff --git a/select2_locale_it.js b/select2_locale_it.js index d4e24de7..5171c162 100644 --- a/select2_locale_it.js +++ b/select2_locale_it.js @@ -4,7 +4,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['it'] = { formatNoMatches: function () { return "Nessuna corrispondenza trovata"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Inserisci ancora " + n + " caratter" + (n == 1? "e" : "i"); }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Inserisci " + n + " caratter" + (n == 1? "e" : "i") + " in meno"; }, diff --git a/select2_locale_ja.js b/select2_locale_ja.js index 81106e78..ddc7abf0 100644 --- a/select2_locale_ja.js +++ b/select2_locale_ja.js @@ -4,7 +4,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['ja'] = { formatNoMatches: function () { return "該当なし"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "後" + n + "文字入れてください"; }, formatInputTooLong: function (input, max) { var n = input.length - max; return "検索文字列が" + n + "文字長すぎます"; }, diff --git a/select2_locale_ka.js b/select2_locale_ka.js index 366cc2d9..f36410ae 100644 --- a/select2_locale_ka.js +++ b/select2_locale_ka.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['ka'] = { formatNoMatches: function () { return "ვერ მოიძებნა"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "გთხოვთ შეიყვანოთ კიდევ " + n + " სიმბოლო"; }, formatInputTooLong: function (input, max) { var n = input.length - max; return "გთხოვთ წაშალოთ " + n + " სიმბოლო"; }, diff --git a/select2_locale_ko.js b/select2_locale_ko.js index 1a84d21e..9324c4bd 100644 --- a/select2_locale_ko.js +++ b/select2_locale_ko.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['ko'] = { formatNoMatches: function () { return "결과 없음"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "너무 짧습니다. "+n+"글자 더 입력해주세요."; }, formatInputTooLong: function (input, max) { var n = input.length - max; return "너무 깁니다. "+n+"글자 지워주세요."; }, diff --git a/select2_locale_lt.js b/select2_locale_lt.js index 2e2f950b..f63a7d10 100644 --- a/select2_locale_lt.js +++ b/select2_locale_lt.js @@ -7,7 +7,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['lt'] = { formatNoMatches: function () { return "Atitikmenų nerasta"; }, formatInputTooShort: function (input, min) { return "Įrašykite dar" + character(min - input.length); }, formatInputTooLong: function (input, max) { return "Pašalinkite" + character(input.length - max); }, diff --git a/select2_locale_lv.js b/select2_locale_lv.js index b300ec77..c684876f 100644 --- a/select2_locale_lv.js +++ b/select2_locale_lv.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['lv'] = { formatNoMatches: function () { return "Sakritību nav"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Lūdzu ievadiet vēl " + n + " simbol" + (n == 11 ? "us" : n%10 == 1 ? "u" : "us"); }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Lūdzu ievadiet par " + n + " simbol" + (n == 11 ? "iem" : n%10 == 1 ? "u" : "iem") + " mazāk"; }, diff --git a/select2_locale_mk.js b/select2_locale_mk.js index 513562c5..4504f903 100644 --- a/select2_locale_mk.js +++ b/select2_locale_mk.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['mk'] = { formatNoMatches: function () { return "Нема пронајдено совпаѓања"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Ве молиме внесете уште " + n + " карактер" + (n == 1 ? "" : "и"); }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Ве молиме внесете " + n + " помалку карактер" + (n == 1? "" : "и"); }, diff --git a/select2_locale_ms.js b/select2_locale_ms.js index 262042aa..21b6a05c 100644 --- a/select2_locale_ms.js +++ b/select2_locale_ms.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['ms'] = { formatNoMatches: function () { return "Tiada padanan yang ditemui"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Sila masukkan " + n + " aksara lagi"; }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Sila hapuskan " + n + " aksara"; }, diff --git a/select2_locale_nl.js b/select2_locale_nl.js index 5b5c4156..76045317 100644 --- a/select2_locale_nl.js +++ b/select2_locale_nl.js @@ -4,7 +4,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['nl'] = { formatNoMatches: function () { return "Geen resultaten gevonden"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Vul " + n + " karakter" + (n == 1? "" : "s") + " meer in"; }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Vul " + n + " karakter" + (n == 1? "" : "s") + " minder in"; }, diff --git a/select2_locale_no.js b/select2_locale_no.js index ab61c082..5e1324d0 100644 --- a/select2_locale_no.js +++ b/select2_locale_no.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['no'] = { formatNoMatches: function () { return "Ingen treff"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Vennligst skriv inn " + n + (n>1 ? " flere tegn" : " tegn til"); }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Vennligst fjern " + n + " tegn"; }, diff --git a/select2_locale_pl.js b/select2_locale_pl.js index 61cad44a..d647dc9c 100644 --- a/select2_locale_pl.js +++ b/select2_locale_pl.js @@ -8,7 +8,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['pl'] = { formatNoMatches: function () { return "Brak wyników"; }, formatInputTooShort: function (input, min) { return "Wpisz co najmniej" + character(min - input.length, "znak", "i"); }, formatInputTooLong: function (input, max) { return "Wpisana fraza jest za długa o" + character(input.length - max, "znak", "i"); }, diff --git a/select2_locale_pt-BR.js b/select2_locale_pt-BR.js index ac4969ac..d097054b 100644 --- a/select2_locale_pt-BR.js +++ b/select2_locale_pt-BR.js @@ -4,7 +4,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['pt-BR'] = { formatNoMatches: function () { return "Nenhum resultado encontrado"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Digite mais " + n + " caracter" + (n == 1? "" : "es"); }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Apague " + n + " caracter" + (n == 1? "" : "es"); }, diff --git a/select2_locale_pt-PT.js b/select2_locale_pt-PT.js index cced7cf3..ee18349c 100644 --- a/select2_locale_pt-PT.js +++ b/select2_locale_pt-PT.js @@ -4,7 +4,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['pt-PT'] = { formatNoMatches: function () { return "Nenhum resultado encontrado"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Introduza " + n + " car" + (n == 1 ? "ácter" : "acteres"); }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Apague " + n + " car" + (n == 1 ? "ácter" : "acteres"); }, diff --git a/select2_locale_ro.js b/select2_locale_ro.js index 87eca4cf..6fb26874 100644 --- a/select2_locale_ro.js +++ b/select2_locale_ro.js @@ -4,7 +4,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['ro'] = { formatNoMatches: function () { return "Nu a fost găsit nimic"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Vă rugăm să introduceți incă " + n + " caracter" + (n == 1 ? "" : "e"); }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Vă rugăm să introduceți mai puțin de " + n + " caracter" + (n == 1? "" : "e"); }, diff --git a/select2_locale_rs.js b/select2_locale_rs.js index 300c01bc..97569fc9 100644 --- a/select2_locale_rs.js +++ b/select2_locale_rs.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['rs'] = { formatNoMatches: function () { return "Ništa nije pronađeno"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Ukucajte bar još " + n + " simbol" + (n % 10 == 1 && n % 100 != 11 ? "" : "a"); }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Obrišite " + n + " simbol" + (n % 10 == 1 && n % 100 != 11 ? "" : "a"); }, diff --git a/select2_locale_ru.js b/select2_locale_ru.js index 5ec58e47..44a36f04 100644 --- a/select2_locale_ru.js +++ b/select2_locale_ru.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['ru'] = { formatNoMatches: function () { return "Совпадений не найдено"; }, formatInputTooShort: function (input, min) { return "Пожалуйста, введите еще хотя бы" + character(min - input.length); }, formatInputTooLong: function (input, max) { return "Пожалуйста, введите на" + character(input.length - max) + " меньше"; }, diff --git a/select2_locale_sk.js b/select2_locale_sk.js index 772f304a..707f5f99 100644 --- a/select2_locale_sk.js +++ b/select2_locale_sk.js @@ -11,7 +11,7 @@ 3: function() { return "tri"; }, 4: function() { return "štyri"; } } - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['sk'] = { formatNoMatches: function () { return "Nenašli sa žiadne položky"; }, formatInputTooShort: function (input, min) { var n = min - input.length; diff --git a/select2_locale_sv.js b/select2_locale_sv.js index d611189a..26f6f512 100644 --- a/select2_locale_sv.js +++ b/select2_locale_sv.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['sv'] = { formatNoMatches: function () { return "Inga träffar"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Var god skriv in " + n + (n>1 ? " till tecken" : " tecken till"); }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Var god sudda ut " + n + " tecken"; }, diff --git a/select2_locale_th.js b/select2_locale_th.js index df59bdac..7004d2a5 100644 --- a/select2_locale_th.js +++ b/select2_locale_th.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['th'] = { formatNoMatches: function () { return "ไม่พบข้อมูล"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "โปรดพิมพ์เพิ่มอีก " + n + " ตัวอักษร"; }, formatInputTooLong: function (input, max) { var n = input.length - max; return "โปรดลบออก " + n + " ตัวอักษร"; }, diff --git a/select2_locale_tr.js b/select2_locale_tr.js index f834dad2..e9d7a0aa 100644 --- a/select2_locale_tr.js +++ b/select2_locale_tr.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['tr'] = { formatNoMatches: function () { return "Sonuç bulunamadı"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "En az " + n + " karakter daha girmelisiniz"; }, formatInputTooLong: function (input, max) { var n = input.length - max; return n + " karakter azaltmalısınız"; }, diff --git a/select2_locale_uk.js b/select2_locale_uk.js index 8d31a056..cd970b35 100644 --- a/select2_locale_uk.js +++ b/select2_locale_uk.js @@ -7,7 +7,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['uk'] = { formatMatches: function (matches) { return character(matches, "результат") + " знайдено, використовуйте клавіші зі стрілками вверх та вниз для навігації."; }, formatNoMatches: function () { return "Нічого не знайдено"; }, formatInputTooShort: function (input, min) { return "Введіть буль ласка ще " + character(min - input.length, "символ"); }, diff --git a/select2_locale_vi.js b/select2_locale_vi.js index 5dbc2753..1d2dc383 100644 --- a/select2_locale_vi.js +++ b/select2_locale_vi.js @@ -6,7 +6,7 @@ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['vi'] = { formatNoMatches: function () { return "Không tìm thấy kết quả"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Vui lòng nhập nhiều hơn " + n + " ký tự" + (n == 1 ? "" : "s"); }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Vui lòng nhập ít hơn " + n + " ký tự" + (n == 1? "" : "s"); }, diff --git a/select2_locale_zh-CN.js b/select2_locale_zh-CN.js index 6add3c52..f20332f3 100644 --- a/select2_locale_zh-CN.js +++ b/select2_locale_zh-CN.js @@ -3,7 +3,7 @@ */ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['zh-CN'] = { formatNoMatches: function () { return "没有找到匹配项"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "请再输入" + n + "个字符";}, formatInputTooLong: function (input, max) { var n = input.length - max; return "请删掉" + n + "个字符";}, diff --git a/select2_locale_zh-TW.js b/select2_locale_zh-TW.js index f072381f..10fe24ea 100644 --- a/select2_locale_zh-TW.js +++ b/select2_locale_zh-TW.js @@ -3,7 +3,7 @@ */ (function ($) { "use strict"; - $.extend($.fn.select2.defaults, { + $.fn.select2.locales['zh-TW'] = { formatNoMatches: function () { return "沒有找到相符的項目"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "請再輸入" + n + "個字元";}, formatInputTooLong: function (input, max) { var n = input.length - max; return "請刪掉" + n + "個字元";},