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 https://select2.org/i18n
$(".js-example-language").select2({
language: "es"
});
I want to be able to add another language "es and pt-BR"
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",
],
},
tools/gulp.config.js
and recompile assets with gulp as explained in the docs.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.