You are here

function locale_js_settings_alter in Drupal 8

Implements hook_js_settings_alter().

Generates the values for the altered core/jquery.ui.datepicker library.

File

core/modules/locale/locale.module, line 616
Enables the translation of the user interface to languages other than English.

Code

function locale_js_settings_alter(&$settings, AttachedAssetsInterface $assets) {
  if (isset($settings['jquery']['ui']['datepicker'])) {
    $language_interface = \Drupal::languageManager()
      ->getCurrentLanguage();
    $settings['jquery']['ui']['datepicker']['isRTL'] = $language_interface
      ->getDirection() == LanguageInterface::DIRECTION_RTL;
    $settings['jquery']['ui']['datepicker']['firstDay'] = \Drupal::config('system.date')
      ->get('first_day');
  }
}