From ea44d254c6908575a18711011b527c8341931d34 Mon Sep 17 00:00:00 2001
From: Marco Villegas <marvil07@gmail.com>
Date: Wed, 21 Apr 2010 00:45:11 -0700
Subject: [PATCH] Provide Locale support for jQuery UI

---
 modules/locale/locale.module |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git modules/locale/locale.module modules/locale/locale.module
index a91bef9..bed85fb 100644
--- modules/locale/locale.module
+++ 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
 
Index: modules/locale/locale.datepicker.js
===================================================================
RCS file: modules/locale/locale.datepicker.js
diff -N modules/locale/locale.datepicker.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/locale/locale.datepicker.js	1 Jan 1970 00:00:00 -0000
@@ -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);

