Tobias Uhmann
Tobias Uhmann

Reputation: 3067

Moodle localized date_selector

The following snippet creates a date selector using the Moodle Forms API:

$form->addElement('date_selector', 'html_id', 'label', $options);

As per documentation (https://docs.moodle.org/dev/lib/formslib.php_Form_Definition#date_selector) options supports the following settings:

array(
    'startyear' => 1970, 
    'stopyear'  => 2020,
    'timezone'  => 99,
    'optional'  => false
);

I am missing an option for localization here. As the Moodle API is based on PHP QuickForm I hoped that I could pass a language option like it is supported by HTML_QuickForm_date (https://pear.php.net/manual/en/package.html.html-quickform.html-quickform-date.php). Apparently, I was wrong.

Is there a way to get a Moodle date picker with non-English month names?

Upvotes: 0

Views: 1097

Answers (1)

Tobias Uhmann
Tobias Uhmann

Reputation: 3067

Also posted the question in the Moodle developer forum: https://moodle.org/mod/forum/discuss.php?d=386699#p1558991

Short answer: Normally, all widgets are localized according to the current language by default. However, we're using Docker which lacks some i18n tools or configuration. Therefore, certain features (like the date picker dialog) are not properly localized.

Upvotes: 0

Related Questions