function locale_install
Same name in other branches
- 7.x modules/locale/locale.install \locale_install()
- 8.9.x core/modules/locale/locale.install \locale_install()
- 10 core/modules/locale/locale.install \locale_install()
- 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::getContainer()->getParameter('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.