localization-rtl-diacritics.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <section>
  2. <h1 id="localization-rtl-diacritics" class="page-header">
  3. Localization, RTL and diacritics support
  4. </h1>
  5. <h2 id="language">Multiple languages</h2>
  6. <p>
  7. Select2 supports displaying the messages in different languages, as well
  8. as providing your own
  9. <a href="options.html#language">custom messages</a>
  10. that can be displayed.
  11. </p>
  12. <p>
  13. The language does not have to be defined when Select2 is being
  14. initialized, but instead can be defined in the <code>[lang]</code>
  15. attribute of any parent elements as <code>[lang="es"]</code>.
  16. </p>
  17. <div class="s2-example">
  18. <p>
  19. <select class="js-example-language js-states form-control">
  20. </select>
  21. </p>
  22. </div>
  23. {% highlight js linenos %}
  24. $(".js-example-language").select2({
  25. language: "es"
  26. });
  27. {% endhighlight %}
  28. <h2 id="rtl">RTL support</h2>
  29. <p>
  30. Select2 will work on RTL websites if the <code>dir</code> attribute is
  31. set on the <code>&lt;select&gt;</code> or any parents of it. You can also
  32. initialize Select2 with <code>dir: "rtl"</code> set.
  33. </p>
  34. <div class="s2-example">
  35. <p>
  36. <select class="js-example-rtl js-states form-control" dir="rtl"></select>
  37. </p>
  38. </div>
  39. {% highlight js linenos %}
  40. $(".js-example-rtl").select2({
  41. dir: "rtl"
  42. });
  43. {% endhighlight %}
  44. <h2 id="diacritics">Diacritics support</h2>
  45. <p>
  46. Select2's default matcher will ignore diacritics, making it easier for
  47. users to filter results in international selects. Type "aero" into the
  48. select below.
  49. </p>
  50. <div class="s2-example">
  51. <p>
  52. <select class="js-example-diacritics form-control">
  53. <option>Aeróbics</option>
  54. <option>Aeróbics en Agua</option>
  55. <option>Aerografía</option>
  56. <option>Aeromodelaje</option>
  57. <option>Águilas</option>
  58. <option>Ajedrez</option>
  59. <option>Ala Delta</option>
  60. <option>Álbumes de Música</option>
  61. <option>Alusivos</option>
  62. <option>Análisis de Escritura a Mano</option>
  63. </select>
  64. </p>
  65. </div>
  66. {% highlight js linenos %}
  67. $(".js-example-diacritics").select2();
  68. {% endhighlight %}
  69. </section>