function LanguageSelectorTranslatableTest::testLanguageStringSelector
Same name in other branches
- 8.9.x core/modules/language/tests/src/Functional/LanguageSelectorTranslatableTest.php \Drupal\Tests\language\Functional\LanguageSelectorTranslatableTest::testLanguageStringSelector()
- 10 core/modules/language/tests/src/Functional/LanguageSelectorTranslatableTest.php \Drupal\Tests\language\Functional\LanguageSelectorTranslatableTest::testLanguageStringSelector()
- 11.x core/modules/language/tests/src/Functional/LanguageSelectorTranslatableTest.php \Drupal\Tests\language\Functional\LanguageSelectorTranslatableTest::testLanguageStringSelector()
Tests content translation language selectors are correctly translated.
File
-
core/
modules/ language/ tests/ src/ Functional/ LanguageSelectorTranslatableTest.php, line 70
Class
- LanguageSelectorTranslatableTest
- Tests the content translation settings language selector options.
Namespace
Drupal\Tests\language\FunctionalCode
public function testLanguageStringSelector() {
// Add another language.
$edit = [
'predefined_langcode' => 'es',
];
$this->drupalGet('admin/config/regional/language/add');
$this->submitForm($edit, 'Add language');
// Translate the string English in Spanish (Inglés). Override config entity.
$name_translation = 'Inglés';
\Drupal::languageManager()->getLanguageConfigOverride('es', 'language.entity.en')
->set('label', $name_translation)
->save();
// Check content translation overview selector.
$path = 'es/admin/config/regional/content-language';
$this->drupalGet($path);
// Get en language from selector.
$option = $this->assertSession()
->optionExists('edit-settings-user-user-settings-language-langcode', 'en');
// Check that the language text is translated.
$this->assertSame($name_translation, $option->getText());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.