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