localization-rtl-diacritics.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. <pre data-fill-from=".js-code-language"></pre>
  24. <script type="text/x-example-code" class="js-code-language">
  25. $(".js-example-language").select2({
  26. language: "es"
  27. });
  28. </script>
  29. <h2 id="rtl">RTL support</h2>
  30. <p>
  31. Select2 will work on RTL websites if the <code>dir</code> attribute is
  32. set on the <code>&lt;select&gt;</code> or any parents of it. You can also
  33. initialize Select2 with <code>dir: "rtl"</code> set.
  34. </p>
  35. <div class="s2-example">
  36. <p>
  37. <select class="js-example-rtl js-states form-control" dir="rtl"></select>
  38. </p>
  39. </div>
  40. <pre data-fill-from=".js-code-rtl"></pre>
  41. <script type="text/x-example-code" class="js-code-rtl">
  42. $(".js-example-rtl").select2({
  43. dir: "rtl"
  44. });
  45. </script>
  46. <h2 id="diacritics">Diacritics support</h2>
  47. <p>
  48. Select2's default matcher will ignore diacritics, making it easier for
  49. users to filter results in international selects. Type "aero" into the
  50. select below.
  51. </p>
  52. <div class="s2-example">
  53. <p>
  54. <select class="js-example-diacritics form-control">
  55. <option>Aeróbics</option>
  56. <option>Aeróbics en Agua</option>
  57. <option>Aerografía</option>
  58. <option>Aeromodelaje</option>
  59. <option>Águilas</option>
  60. <option>Ajedrez</option>
  61. <option>Ala Delta</option>
  62. <option>Álbumes de Música</option>
  63. <option>Alusivos</option>
  64. <option>Análisis de Escritura a Mano</option>
  65. </select>
  66. </p>
  67. </div>
  68. <pre data-fill-from=".js-code-diacritics"></pre>
  69. <script type="text/x-example-code" class="js-code-diacritics">
  70. $(".js-example-diacritics").select2();
  71. </script>
  72. </section>