function locale_install in Drupal 8
Same name and namespace in other branches
- 5 modules/locale/locale.install \locale_install()
- 6 modules/locale/locale.install \locale_install()
- 7 modules/locale/locale.install \locale_install()
- 9 core/modules/locale/locale.install \locale_install()
- 10 core/modules/locale/locale.install \locale_install()
Implements hook_install().
File
- core/
modules/ locale/ locale.install, line 16 - Install, update, and uninstall functions for the Locale module.
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);
}