From 6fcd136eddecc6fd49e27f543ec4150a9d6a7cec Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 29 Sep 2021 11:05:04 +0200 Subject: [PATCH] Bug 29133: Correct select2 strings MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We are using 'max'/'min' when the arguments are 'maximum'/'minimum'. Also using %n, %d when only %s is working in .format() Have a look at https://github.com/select2/select2/blob/45f2b83ceed5231afa7b3d5b12b58ad335edd82e/src/js/select2/i18n/en.js It's Select2 v.4.0.13, the one we are using. We should match what's there. Test plan: Bug 29002 is using minimumInputLength, you can see the difference when selecting a patron: "Please enter %s or more characters" vs "Please enter 3 or more characters" Signed-off-by: Martin Renvoize Signed-off-by: Joonas Kylmälä Bug 29133: (follow-up) Fix for argument mismatch Signed-off-by: Martin Renvoize JK: fix typo in commit message Signed-off-by: Joonas Kylmälä Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall (cherry picked from commit 500725826f8e21db79b823c5e5f97618bb3e9fe2) Signed-off-by: Fridolin Somers --- koha-tmpl/intranet-tmpl/prog/js/select2.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/select2.js b/koha-tmpl/intranet-tmpl/prog/js/select2.js index 0b68c3fd28..42383dd547 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/select2.js +++ b/koha-tmpl/intranet-tmpl/prog/js/select2.js @@ -6,20 +6,20 @@ $.fn.select2.defaults.set("width", "element" ); // Internationalization $.fn.select2.defaults.set("language", { errorLoading:function(){ return __("The results could not be loaded"); }, - inputTooLong:function(e){ - var n = e.input.length - e.max; - return __("Please delete %d character(s)").format(n); + inputTooLong:function(args){ + var n = args.input.length - args.maximum; + return __("Please delete %s character(s)").format(n); }, - inputTooShort:function(e){ - var n = e.min - e.input.length; - return __("Please enter %n or more characters").format(n); + inputTooShort:function(args){ + var n = args.minimum - args.input.length; + return __("Please enter %s or more characters").format(n); }, formatResult: function(item) { return $('
', {title: item.element[0].title}).text(item.text); }, loadingMore:function(){ return __("Loading more results…"); }, - maximumSelected:function(e){ - return __("You can only select %s item(s)").format(e.max); + maximumSelected:function(args){ + return __("You can only select %s item(s)").format(args.maximum); }, noResults:function(){return __("No results found"); }, searching:function(){return __("Searching…"); }, -- 2.39.5