function LocaleConfigSubscriberForeignTest::testEnglish
Same name in other branches
- 9 core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberForeignTest.php \Drupal\Tests\locale\Kernel\LocaleConfigSubscriberForeignTest::testEnglish()
- 10 core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberForeignTest.php \Drupal\Tests\locale\Kernel\LocaleConfigSubscriberForeignTest::testEnglish()
- 11.x core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberForeignTest.php \Drupal\Tests\locale\Kernel\LocaleConfigSubscriberForeignTest::testEnglish()
Tests that adding English creates a translation override.
File
-
core/
modules/ locale/ tests/ src/ Kernel/ LocaleConfigSubscriberForeignTest.php, line 123
Class
- LocaleConfigSubscriberForeignTest
- Tests default configuration handling with a foreign default language.
Namespace
Drupal\Tests\locale\KernelCode
public function testEnglish() {
$config_name = 'locale_test.translation';
ConfigurableLanguage::createFromLangcode('en')->save();
// Adding a language on the UI would normally call updateConfigTranslations.
$this->localeConfigManager
->updateConfigTranslations([
$config_name,
], [
'en',
]);
$this->assertConfigOverride($config_name, 'test', 'English test', 'en');
$this->configFactory
->getEditable('locale.settings')
->set('translate_english', TRUE)
->save();
$this->saveLocaleTranslationData($config_name, 'test', 'English test', 'Updated English test', 'en');
$this->assertTranslation($config_name, 'Updated English test', 'en', FALSE);
$this->saveLanguageOverride($config_name, 'test', 'Updated English', 'en');
$this->assertTranslation($config_name, 'Updated English', 'en');
$this->deleteLocaleTranslationData($config_name, 'test', 'English test', 'en');
$this->assertNoConfigOverride($config_name, 'en');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.