Jonathan Druart
74e5353539
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>
39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
/* global __ */
|
|
$.fn.select2.defaults.set("allowClear", true);
|
|
$.fn.select2.defaults.set("placeholder", "");
|
|
$.fn.select2.defaults.set("width", "element" );
|
|
|
|
// Internationalization
|
|
$.fn.select2.defaults.set("language", {
|
|
errorLoading:function(){ return __("The results could not be loaded"); },
|
|
inputTooLong:function(args){
|
|
var n = args.input.length - args.maximum;
|
|
return __("Please delete %s character(s)").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(args){
|
|
return __("You can only select %s item(s)").format(args.maximum);
|
|
},
|
|
noResults:function(){return __("No results found"); },
|
|
searching:function(){return __("Searching…"); },
|
|
removeAllItems:function(){return __("Remove all items"); },
|
|
removeItem:function(){return __("Remove item"); }
|
|
});
|
|
|
|
$(document).ready(function(){
|
|
$(".select2").select2();
|
|
$(".select2").on("select2:clear", function () {
|
|
$(this).on("select2:opening.cancelOpen", function (evt) {
|
|
evt.preventDefault();
|
|
|
|
$(this).off("select2:opening.cancelOpen");
|
|
});
|
|
});
|
|
});
|