autocompleter action translation

How to change the default "please enter 2 or more characters" message in the CF autocompleter action.

Overview

The default message is hardcoded within the Select2 library file used by the action.
Edit the specific library file to modify the message strings directly. Locate and update the `formatInputTooShort` function within the file to display your custom text.

Answered
teldrive teldrive 22 Mar, 2015
I have seen some fields in autocompleter action to customize messages when loading database elements
But i haven't found how to change default message "please enter 2 o more characters" , is it posible?
[attachment=0]Captura.JPG[/attachment]
Gr GreyHead 22 Mar, 2015
Answer
1 Likes
Hi Teldrive,

It's embedded right at the end of the Select 2 library file /libraries/cegcore/assets/select2/select2.min.js (line-breaks added)
formatNoMatches:function(){
  return"No matches found"
},
formatAjaxError:function(){
  return"Loading failed"
},
formatInputTooShort:function(a,b){
  var c=b-a.length;
  return"Please enter "+c+" or more character"+(1==c?"":"s")
},
formatInputTooLong:function(a,b){
  var c=a.length-b;
  return"Please delete "+c+" character"+(1==c?"":"s")
},
formatSelectionTooBig:function(a){
  return"You can only select "+a+" item"+(1==a?"":"s")
},
formatLoadMore:function(){
  return"Loading more results\u2026"
},
formatSearching:function(){
  return"Searching\u2026"}
},
a.extend(a.fn.select2.defaults,a.fn.select2.locales.en),
a.fn.select2.ajaxDefaults={
  transport:a.ajax,params:{type:"GET",cache:!1,dataType:"json"}
},
window.Select2={query:{ajax:G,local:H,tags:I},util:{debounce:w,markMatch:E,escapeMarkup:F,stripDiacritics:o},"class":{"abstract":d,single:e,multi:f}
}}}(jQuery);

Bob
teldrive teldrive 23 Mar, 2015
thanks a lot Bob
it works fine
This topic is locked and no more replies can be posted.