Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/01/2016, 11:59
Avatar de milciadesgonzalez
milciadesgonzalez
 
Fecha de Ingreso: junio-2014
Ubicación: Paraguay
Mensajes: 34
Antigüedad: 9 años, 10 meses
Puntos: 1
Cambiar el mensaje de select2 minimum input length

Buenas comunidad,

Estoy usando el plugin select2 para el autocompletado en un campo, lo que necesito hacer es cambiar el texto que dice:

Please enter "1" more characters por " Ingrese mínimo 3 caracteres " sin editar el archivo fuente del plugin.

Este seria el código de ejemplo, escucho sugerencias para solucionar desde ya gracias.

Código Javascript:
Ver original
  1. $(".js-data-example-ajax").select2({
  2.       ajax: {
  3.         url: "https://api.github.com/search/repositories",
  4.         dataType: 'json',
  5.         delay: 250,
  6.         data: function (params) {
  7.           return {
  8.             q: params.term, // search term
  9.             page: params.page
  10.           };
  11.         },
  12.         processResults: function (data, params) {
  13.           // parse the results into the format expected by Select2
  14.           // since we are using custom formatting functions we do not need to
  15.           // alter the remote JSON data, except to indicate that infinite
  16.           // scrolling can be used
  17.           params.page = params.page || 1;
  18.      
  19.           return {
  20.             results: data.items,
  21.             pagination: {
  22.               more: (params.page * 30) < data.total_count
  23.             }
  24.           };
  25.         },
  26.         cache: true
  27.       },
  28.       minimumInputLength: 1,
  29.      formatInputTooShort: function(input, min) {   //no funciona
  30.                 return "Ingrese mínimo 3 caracteres";
  31.      }
  32.    
  33.     });