function DisplayTest::addTranslation
Same name in other branches
- 9 core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php \Drupal\Tests\views_ui\FunctionalJavascript\DisplayTest::addTranslation()
- 10 core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php \Drupal\Tests\views_ui\FunctionalJavascript\DisplayTest::addTranslation()
Helper function for adding interface text translations.
1 call to DisplayTest::addTranslation()
- DisplayTest::testAddDisplayBlockTranslation in core/
modules/ views_ui/ tests/ src/ FunctionalJavascript/ DisplayTest.php - Test if 'add' translations are filtered from multilingual display options.
File
-
core/
modules/ views_ui/ tests/ src/ FunctionalJavascript/ DisplayTest.php, line 193
Class
- DisplayTest
- Tests the display UI.
Namespace
Drupal\Tests\views_ui\FunctionalJavascriptCode
private function addTranslation($langcode, $source_string, $translation_string) : void {
$storage = \Drupal::service('locale.storage');
$string = $storage->findString([
'source' => $source_string,
]);
if (is_null($string)) {
$string = new SourceString();
$string->setString($source_string)
->setStorage($storage)
->save();
}
$storage->createTranslation([
'lid' => $string->getId(),
'language' => $langcode,
'translation' => $translation_string,
])
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.