locale.datepicker.es6.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /**
  2. * @file
  3. * Datepicker JavaScript for the Locale module.
  4. */
  5. (function ($, Drupal, drupalSettings) {
  6. /**
  7. * Attaches language support to the jQuery UI datepicker component.
  8. *
  9. * @type {Drupal~behavior}
  10. */
  11. Drupal.behaviors.localeDatepicker = {
  12. attach(context, settings) {
  13. // This code accesses drupalSettings and localized strings via Drupal.t().
  14. // So this code should run after these are initialized. By placing it in an
  15. // attach behavior this is assured.
  16. $.datepicker.regional['drupal-locale'] = $.extend({
  17. closeText: Drupal.t('Done'),
  18. prevText: Drupal.t('Prev'),
  19. nextText: Drupal.t('Next'),
  20. currentText: Drupal.t('Today'),
  21. monthNames: [
  22. Drupal.t('January', {}, { context: 'Long month name' }),
  23. Drupal.t('February', {}, { context: 'Long month name' }),
  24. Drupal.t('March', {}, { context: 'Long month name' }),
  25. Drupal.t('April', {}, { context: 'Long month name' }),
  26. Drupal.t('May', {}, { context: 'Long month name' }),
  27. Drupal.t('June', {}, { context: 'Long month name' }),
  28. Drupal.t('July', {}, { context: 'Long month name' }),
  29. Drupal.t('August', {}, { context: 'Long month name' }),
  30. Drupal.t('September', {}, { context: 'Long month name' }),
  31. Drupal.t('October', {}, { context: 'Long month name' }),
  32. Drupal.t('November', {}, { context: 'Long month name' }),
  33. Drupal.t('December', {}, { context: 'Long month name' }),
  34. ],
  35. monthNamesShort: [
  36. Drupal.t('Jan'),
  37. Drupal.t('Feb'),
  38. Drupal.t('Mar'),
  39. Drupal.t('Apr'),
  40. Drupal.t('May'),
  41. Drupal.t('Jun'),
  42. Drupal.t('Jul'),
  43. Drupal.t('Aug'),
  44. Drupal.t('Sep'),
  45. Drupal.t('Oct'),
  46. Drupal.t('Nov'),
  47. Drupal.t('Dec'),
  48. ],
  49. dayNames: [
  50. Drupal.t('Sunday'),
  51. Drupal.t('Monday'),
  52. Drupal.t('Tuesday'),
  53. Drupal.t('Wednesday'),
  54. Drupal.t('Thursday'),
  55. Drupal.t('Friday'),
  56. Drupal.t('Saturday'),
  57. ],
  58. dayNamesShort: [
  59. Drupal.t('Sun'),
  60. Drupal.t('Mon'),
  61. Drupal.t('Tue'),
  62. Drupal.t('Wed'),
  63. Drupal.t('Thu'),
  64. Drupal.t('Fri'),
  65. Drupal.t('Sat'),
  66. ],
  67. dayNamesMin: [
  68. Drupal.t('Su'),
  69. Drupal.t('Mo'),
  70. Drupal.t('Tu'),
  71. Drupal.t('We'),
  72. Drupal.t('Th'),
  73. Drupal.t('Fr'),
  74. Drupal.t('Sa'),
  75. ],
  76. dateFormat: Drupal.t('mm/dd/yy'),
  77. firstDay: 0,
  78. isRTL: 0,
  79. }, drupalSettings.jquery.ui.datepicker);
  80. $.datepicker.setDefaults($.datepicker.regional['drupal-locale']);
  81. },
  82. };
  83. }(jQuery, Drupal, drupalSettings));