You are here

function locale_library_info_alter in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/locale/locale.module \locale_library_info_alter()
  2. 10 core/modules/locale/locale.module \locale_library_info_alter()

Implements hook_library_info_alter().

Provides language support.

File

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

Code

function locale_library_info_alter(array &$libraries, $module) {

  // When the locale module is enabled, we update the core/drupal library to
  // have a dependency on the locale/translations library, which provides
  // window.drupalTranslations, containing the translations for all strings in
  // JavaScript assets in the current language.
  // @see locale_js_alter()
  if ($module === 'core' && isset($libraries['drupal'])) {
    $libraries['drupal']['dependencies'][] = 'locale/translations';
  }
}