From f87ce84d722663cef048a45aa8127aeca6423015 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 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 --- koha-tmpl/intranet-tmpl/prog/js/select2.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/select2.js b/koha-tmpl/intranet-tmpl/prog/js/select2.js index 0b68c3fd28..ef000ec7f0 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); + var n = e.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.20.1