function locale_install

Same name in other branches
  1. 7.x modules/locale/locale.install \locale_install()
  2. 9 core/modules/locale/locale.install \locale_install()
  3. 10 core/modules/locale/locale.install \locale_install()
  4. 11.x core/modules/locale/locale.install \locale_install()

Implements hook_install().

File

core/modules/locale/locale.install, line 16

Code

function locale_install() {
    // Create the interface translations directory and ensure it's writable.
    if (!($directory = \Drupal::config('locale.settings')->get('translation.path'))) {
        $site_path = \Drupal::service('site.path');
        $directory = $site_path . '/files/translations';
        \Drupal::configFactory()->getEditable('locale.settings')
            ->set('translation.path', $directory)
            ->save();
    }
    \Drupal::service('file_system')->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS);
}

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