i18n.rst 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. I18N
  2. ====
  3. The plugin supports i18n for the month and weekday names and the ``weekStart`` option. The default is English ("en"); other available translations are available in the ``js/locales/`` directory, simply include your desired locale after the plugin. To add more languages, simply add a key to ``$.fn.datepicker.dates``, before calling ``.datepicker()``. Example
  4. ::
  5. $.fn.datepicker.dates['en'] = {
  6. days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
  7. daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  8. daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
  9. months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
  10. monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
  11. today: "Today",
  12. clear: "Clear",
  13. format: "mm/dd/yyyy",
  14. titleFormat: "MM yyyy", /* Leverages same syntax as 'format' */
  15. weekStart: 0
  16. };
  17. Right-to-left languages may also include ``rtl: true`` to make the calendar display appropriately.
  18. If your browser (or those of your users) is displaying characters wrong, chances are the browser is loading the javascript file with a non-unicode encoding. Simply add ``charset="UTF-8"`` to your ``script`` tag:
  19. .. code-block:: html
  20. <script src="bootstrap-datepicker.XX.js" charset="UTF-8"></script>
  21. ::
  22. $('.datepicker').datepicker({
  23. language: 'XX'
  24. });
  25. .. figure:: _static/screenshots/option_language.png
  26. :align: center