function LocaleHooks::libraryInfoAlter

Implements hook_library_info_alter().

Provides language support.

File

core/modules/locale/src/Hook/LocaleHooks.php, line 254

Class

LocaleHooks
Hook implementations for locale.

Namespace

Drupal\locale\Hook

Code

public function libraryInfoAlter(array &$libraries, $module) : void {
    // 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';
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.