From 54dbb825a89bee656b4626b54841f566398c102a Mon Sep 17 00:00:00 2001 From: Jens Rantil Date: Wed, 13 Mar 2013 17:52:17 +0100 Subject: [PATCH 1/3] Adding a translation template This will make it easier to translate to other languages. --- select2_locale_en.js.template | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 select2_locale_en.js.template diff --git a/select2_locale_en.js.template b/select2_locale_en.js.template new file mode 100644 index 00000000..53f60356 --- /dev/null +++ b/select2_locale_en.js.template @@ -0,0 +1,15 @@ +/** + * Select2 translation. + */ +(function ($) { + "use strict"; + + $.extend($.fn.select2.defaults, { + formatNoMatches: function () { return "No matches found"; }, + formatInputTooShort: function (input, min) { var n = min - input.length; return "Please enter " + n + " more character" + (n == 1 ? "" : "s"); }, + formatInputTooLong: function (input, max) { var n = input.length - max; return "Please enter " + n + " less 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..."; } + }); +})(jQuery); From 96d319f9d2b78bb71cd2aedaf377683a26f74dfb Mon Sep 17 00:00:00 2001 From: Jens Rantil Date: Wed, 13 Mar 2013 17:59:59 +0100 Subject: [PATCH 2/3] Mentioning i18n in README Should probably be documented on http://ivaynberg.github.com/select2/, too, but I'm not very much of a Jekyll dude. --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 35884c01..689d91ff 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,15 @@ Integrations * [Django](https://github.com/applegrew/django-select2) * [Symfony](https://github.com/19Gerhard85/sfSelect2WidgetsPlugin) +Internationalization (i18n) +--------------------------- + +Select2 supports multiple languages by simply including the right +language JS file (`select2_locale_it.js`, `select2_locale_nl.js` etc.). + +Missing a language? Just copy `select2_locale_en.js.template`, translate +it and make a pull request back to Select2 here on Github. + Bug tracker ----------- @@ -43,7 +52,6 @@ Have a bug? Please create an issue here on GitHub! https://github.com/ivaynberg/select2/issues - Mailing list ------------ From 84e5cbb154893119fcd169bc3b4a09c6407dde53 Mon Sep 17 00:00:00 2001 From: Jens Rantil Date: Wed, 13 Mar 2013 18:01:28 +0100 Subject: [PATCH 3/3] Suggesting author header in translation files This can be highly useful when a translation need to be updated and you need to contact an older translator. --- select2_locale_en.js.template | 2 ++ 1 file changed, 2 insertions(+) diff --git a/select2_locale_en.js.template b/select2_locale_en.js.template index 53f60356..260c6c41 100644 --- a/select2_locale_en.js.template +++ b/select2_locale_en.js.template @@ -1,5 +1,7 @@ /** * Select2 translation. + * + * Author: Your Name */ (function ($) { "use strict";