MDL-31622 Forms: Date selector supports i18n

This commit is contained in:
Frederic Massart
2012-07-13 08:57:29 +08:00
parent 3b52187e25
commit 7397acb145
3 changed files with 47 additions and 2 deletions
@@ -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;}
+24 -1
View File
@@ -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();
+22 -1
View File
@@ -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;
}