protected function WebTestBase::writeCustomTranslations in SimpleTest 8.3
Writes custom translations to the test site's settings.php.
Use TestBase::addCustomTranslations() to queue custom translations before calling this method.
File
- src/
WebTestBase.php, line 477
Class
- WebTestBase
- Test case for typical Drupal tests.
Namespace
Drupal\simpletestCode
protected function writeCustomTranslations() {
$settings = [];
foreach ($this->customTranslations as $langcode => $values) {
$settings_key = 'locale_custom_strings_' . $langcode;
// Update in-memory settings directly.
$this
->settingsSet($settings_key, $values);
$settings['settings'][$settings_key] = (object) [
'value' => $values,
'required' => TRUE,
];
}
// Only rewrite settings if there are any translation changes to write.
if (!empty($settings)) {
$this
->writeSettings($settings);
}
}