2.2 KiB
title | taxonomy | process | never_cache_twig | ||||
---|---|---|---|---|---|---|---|
Internationalization |
|
|
true |
{% do assets.addJs('https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/i18n/es.js', 90) %}
Multiple languages (localization)
Select2 can load message translations for different languages from language files.
The language does not have to be defined when Select2 is being initialized, but instead can be defined in the [lang]
attribute of any parent elements as [lang="es"]
.
$(".js-example-language").select2({
language: "es"
});
You may alternatively provide your own custom messages to be displayed.
RTL support
Select2 will work on RTL websites if the dir
attribute is set on the <select>
or any parents of it. You can also initialize Select2 with the dir: "rtl"
configuration option.
$(".js-example-rtl").select2({
dir: "rtl"
});
Transliteration support (diacritics)
Select2's default matcher will transliterate diacritic-modified letters into their ASCII counterparts, making it easier for users to filter results in international selects. Type "aero" into the select below.
Aeróbics Aeróbics en Agua Aerografía Aeromodelaje Águilas Ajedrez Ala Delta Álbumes de Música Alusivos Análisis de Escritura a Mano
$(".js-example-diacritics").select2();