Implement hook_library_info_alter().
Provides the language support for the jQuery UI Date Picker.
function locale_library_info_alter(&$libraries, $module) {
if ($module == 'system' && isset($libraries['jquery.ui.datepicker'])) {
$language_interface = language(Language::TYPE_INTERFACE);
// locale.datepicker.js should be added in the JS_LIBRARY group, so that
// this attach behavior will execute early. JS_LIBRARY is the default for
// hook_library_info_alter(), thus does not have to be specified explicitly.
$libraries['jquery.ui.datepicker']['dependencies'][] = array(
'locale',
'drupal.locale.datepicker',
);
$libraries['jquery.ui.datepicker']['js'][] = array(
'data' => array(
'jquery' => array(
'ui' => array(
'datepicker' => array(
'isRTL' => $language_interface->direction == Language::DIRECTION_RTL,
'firstDay' => config('system.date')
->get('first_day'),
),
),
),
),
'type' => 'setting',
);
}
}