Select2 Internationalization
Hello, how are you? I wanted to know how to translate the text 'No results found' from Select2 using Metronic 8.
https://preview.keenthemes.com/html/metronic/docs/forms/select2
Is there an example
$(".js-example-language").select2({
language: "es"
});
Replies (4)
So if I just do this, it will work?
select2: {
styles: [
"{$config.path.node_modules}/select2/dist/css/select2.css",
],
scripts: [
"{$config.path.node_modules}/select2/dist/js/select2.full.js",
"{$config.path.node_modules}/select2/dist/js/i18n/es.js",
"{$config.path.node_modules}/select2/dist/js/i18n/pt-BR.js",
"{$config.path.common_src}/js/vendors/plugins/select2.init.js",
],
},
And to use it, would I have to add this code too?
$(".form-select").select2({
language: "pt-BR"
});
Hi,
Yes, you just need to modify the gulp config, recompile the assets, and use the below select2 init code with the required lang.
Regards.
Hi,
Please add the required language's source in the select2 plugin build:
select2: {
styles: [
"{$config.path.node_modules}/select2/dist/css/select2.css",
],
scripts: [
"{$config.path.node_modules}/select2/dist/js/select2.full.js",
"{$config.path.node_modules}/select2/dist/js/i18n/es.js",
"{$config.path.common_src}/js/vendors/plugins/select2.init.js",
],
}, in
tools/gulp.config.js and recompile assets with gulp as explained in the docs.Regards.