summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/locale/locale.datepicker.js70
-rw-r--r--modules/locale/locale.module22
2 files changed, 92 insertions, 0 deletions
diff --git a/modules/locale/locale.datepicker.js b/modules/locale/locale.datepicker.js
new file mode 100644
index 000000000..6906fb5e9
--- /dev/null
+++ b/modules/locale/locale.datepicker.js
@@ -0,0 +1,70 @@
+// $Id$
+(function ($) {
+
+$.datepicker.regional['drupal-locale'] = {
+ closeText: Drupal.t('Done'),
+ prevText: Drupal.t('Prev'),
+ nextText: Drupal.t('Next'),
+ currentText: Drupal.t('Today'),
+ monthNames: [
+ Drupal.t('January'),
+ Drupal.t('February'),
+ Drupal.t('March'),
+ Drupal.t('April'),
+ Drupal.t('May'),
+ Drupal.t('June'),
+ Drupal.t('July'),
+ Drupal.t('August'),
+ Drupal.t('September'),
+ Drupal.t('October'),
+ Drupal.t('November'),
+ Drupal.t('December')
+ ],
+ monthNamesShort: [
+ Drupal.t('Jan'),
+ Drupal.t('Feb'),
+ Drupal.t('Mar'),
+ Drupal.t('Apr'),
+ Drupal.t('May'),
+ Drupal.t('Jun'),
+ Drupal.t('Jul'),
+ Drupal.t('Aug'),
+ Drupal.t('Sep'),
+ Drupal.t('Oct'),
+ Drupal.t('Nov'),
+ Drupal.t('Dec')
+ ],
+ dayNames: [
+ Drupal.t('Sunday'),
+ Drupal.t('Monday')
+ Drupal.t('Tuesday')
+ Drupal.t('Wednesday')
+ Drupal.t('Thursday')
+ Drupal.t('Friday')
+ Drupal.t('Saturday')
+ ],
+ dayNamesShort: [
+ Drupal.t('Sun')
+ Drupal.t('Mon')
+ Drupal.t('Tue')
+ Drupal.t('Wed')
+ Drupal.t('Thu')
+ Drupal.t('Fri')
+ Drupal.t('Sat')
+ ],
+ dayNamesMin: [
+ Drupal.t('Su')
+ Drupal.t('Mo')
+ Drupal.t('Tu')
+ Drupal.t('We')
+ Drupal.t('Th')
+ Drupal.t('Fr')
+ Drupal.t('Sa')
+ ],
+ dateFormat: Drupal.t('mm/dd/yy'),
+ firstDay: Drupal.settings.jqueryuidatepicker.firstDay,
+ isRTL: Drupal.settings.jqueryuidatepicker.rtl
+};
+$.datepicker.setDefaults($.datepicker.regional['drupal-locale']);
+
+})(jQuery);
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index f553fe16d..4c58a8e00 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -892,6 +892,28 @@ function locale_css_alter(&$css) {
}
}
+ /**
+ * Implement hook_library_alter().
+ *
+ * Provides the language support for the jQuery UI Date Picker.
+ */
+function locale_library_alter(&$libraries, $module) {
+ global $language;
+ if ($module == 'system' && isset($libraries['system']['ui.datepicker'])) {
+ $datepicker = drupal_get_path('module', 'locale') . '/locale.datepicker.js';
+ $libraries['system']['ui.datepicker']['js'][$datepicker] = array('weight' => JS_THEME);
+ $libraries['system']['ui.datepicker']['js'][] = array(
+ 'data' => array(
+ 'jqueryuidatepicker' => array(
+ 'rtl' => $language->direction == LANGUAGE_RTL,
+ 'firstDay' => variable_get('date_first_day', 0),
+ ),
+ ),
+ 'type' => 'setting',
+ );
+ }
+}
+
// ---------------------------------------------------------------------------------
// Language switcher block