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 45f2b83cee/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 <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Bug 29133: (follow-up) Fix for argument mismatch

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
JK: fix typo in commit message
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2021-09-29 11:05:04 +02:00
parent cbf405828a
commit 74e5353539

View file

@ -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 $('<div>', {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…"); },