I followed the guide to configure select2 and changed the lang to “es”, adding debug messages I got this:
Select2: The language file for “./i18n/es” could not be automatically loaded. A fallback will be used instead. select2.js:5346:23
in app.js:
import $ from 'jquery';
import select2 from 'select2';
select2();
// Configuración global de Select2 en español
$.fn.select2.defaults.set('language', 'es');
in form.blade.php
<script type="module">
$.fn.select2.defaults.set('amdLanguageBase', 'select2/i18n/');
$.fn.select2.defaults.set('amdBase', 'select2/');
let url_search = "{{ route('address.search') }}";
$('.from-data-ajax').select2({
//'amdLanguageBase':'select2/i18n/',
language:"es",
ajax: {
url: url_search,
dataType: 'json'
// Additional AJAX parameters go here; see the end of this chapter for the full code of this example
},
"debug":true
});
</script>
npm list
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]