function LocaleUpdateBase::setTranslationsDirectory

Same name and namespace in other branches
  1. 10 core/modules/locale/tests/src/Functional/LocaleUpdateBase.php \Drupal\Tests\locale\Functional\LocaleUpdateBase::setTranslationsDirectory()
  2. 9 core/modules/locale/tests/src/Functional/LocaleUpdateBase.php \Drupal\Tests\locale\Functional\LocaleUpdateBase::setTranslationsDirectory()
  3. 8.9.x core/modules/locale/tests/src/Functional/LocaleUpdateBase.php \Drupal\Tests\locale\Functional\LocaleUpdateBase::setTranslationsDirectory()
  4. main core/modules/locale/tests/src/Functional/LocaleUpdateBase.php \Drupal\Tests\locale\Functional\LocaleUpdateBase::setTranslationsDirectory()

Sets the value of the default translations directory.

Parameters

string $path: Path of the translations directory relative to the drupal installation directory.

2 calls to LocaleUpdateBase::setTranslationsDirectory()
LocaleTranslationChangeProjectVersionTest::setUp in core/modules/locale/tests/src/Functional/LocaleTranslationChangeProjectVersionTest.php
LocaleUpdateBase::setTranslationFiles in core/modules/locale/tests/src/Functional/LocaleUpdateBase.php
Setup the environment containing local and remote translation files.

File

core/modules/locale/tests/src/Functional/LocaleUpdateBase.php, line 81

Class

LocaleUpdateBase
Base class for testing updates to string translations.

Namespace

Drupal\Tests\locale\Functional

Code

protected function setTranslationsDirectory($path) {
  \Drupal::service('file_system')->prepareDirectory($path, FileSystemInterface::CREATE_DIRECTORY);
  $settings['settings']['locale_translation_path'] = (object) [
    'value' => $path,
    'required' => TRUE,
  ];
  $this->writeSettings($settings);
  $settings = Settings::getAll();
  $settings['locale_translation_path'] = $path;
  new Settings($settings);
}

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