Skip to content
Browse files

MDL-31622 Forms: Date selector supports i18n

  • Loading branch information...
1 parent 3b52187 commit 7397acb145f4865db5e8579d620ff7a72d55baa7 @FMCorz FMCorz committed Jun 28, 2012
View
1 lib/form/yui/dateselector/assets/skins/sam/dateselector.css
@@ -1,3 +1,4 @@
#dateselector-calendar-panel {background-color:#999;border-bottom:3px solid #999;border-right:3px solid #999;}
#dateselector-calendar-content {border:1px solid #666;margin-top:-3px;margin-left:-3px;}
+#dateselector-calendar-content_t th.calweekdaycell {padding-left:3px; padding-right:3px;}
body.ie #dateselector-calendar-panel.yui3-overlay-hidden table {display:none;}
View
25 lib/form/yui/dateselector/dateselector.js
@@ -197,7 +197,30 @@ YUI.add('moodle-form-dateselector', function(Y) {
this.calendar = new YAHOO.widget.Calendar(document.getElementById('dateselector-calendar-content'), {
iframe: false,
hide_blank_weeks: true,
- start_weekday: config.firstdayofweek
+ start_weekday: config.firstdayofweek,
+ locale_weekdays: 'medium',
+ locale_months: 'long',
+ WEEKDAYS_MEDIUM: [
+ config.sun,
+ config.mon,
+ config.tue,
+ config.wed,
+ config.thu,
+ config.fri,
+ config.sat ],
+ MONTHS_LONG: [
+ config.january,
+ config.february,
+ config.march,
+ config.april,
+ config.may,
+ config.june,
+ config.july,
+ config.august,
+ config.september,
+ config.october,
+ config.november,
+ config.december ],
});
this.calendar.changePageEvent.subscribe(function(){
this.fix_position();
View
23 lib/formslib.php
@@ -79,7 +79,28 @@ function form_init_date_js() {
if (!$done) {
$module = 'moodle-form-dateselector';
$function = 'M.form.dateselector.init_date_selectors';
- $config = array(array('firstdayofweek'=>get_string('firstdayofweek', 'langconfig')));
+ $config = array(array(
+ 'firstdayofweek' => get_string('firstdayofweek', 'langconfig'),
+ 'mon' => strftime('%a', 360000), // 5th Jan 1970 at 12pm
+ 'tue' => strftime('%a', 446400),
+ 'wed' => strftime('%a', 532800),
+ 'thu' => strftime('%a', 619200),
+ 'fri' => strftime('%a', 705600),
+ 'sat' => strftime('%a', 792000),
+ 'sun' => strftime('%a', 878400),
+ 'january' => strftime('%B', 14400), // 1st Jan 1970 at 12pm
+ 'february' => strftime('%B', 2692800),
+ 'march' => strftime('%B', 5112000),
+ 'april' => strftime('%B', 7790400),
+ 'may' => strftime('%B', 10382400),
+ 'june' => strftime('%B', 13060800),
+ 'july' => strftime('%B', 15652800),
+ 'august' => strftime('%B', 18331200),
+ 'september' => strftime('%B', 21009600),
+ 'october' => strftime('%B', 23601600),
+ 'november' => strftime('%B', 26280000),
+ 'december' => strftime('%B', 28872000)
+ ));
$PAGE->requires->yui_module($module, $function, $config);
$done = true;
}

0 comments on commit 7397acb

Please sign in to comment.
Something went wrong with that request. Please try again.