function LocaleStringTest::createAllTranslations
Same name in other branches
- 8.9.x core/modules/locale/tests/src/Kernel/LocaleStringTest.php \Drupal\Tests\locale\Kernel\LocaleStringTest::createAllTranslations()
- 10 core/modules/locale/tests/src/Kernel/LocaleStringTest.php \Drupal\Tests\locale\Kernel\LocaleStringTest::createAllTranslations()
- 11.x core/modules/locale/tests/src/Kernel/LocaleStringTest.php \Drupal\Tests\locale\Kernel\LocaleStringTest::createAllTranslations()
Creates translations for source string and all languages.
Parameters
\Drupal\locale\StringInterface $source: The source string.
array $values: The values array.
Return value
array Translation list.
2 calls to LocaleStringTest::createAllTranslations()
- LocaleStringTest::testStringCrudApi in core/
modules/ locale/ tests/ src/ Kernel/ LocaleStringTest.php - Tests CRUD API.
- LocaleStringTest::testStringSearchApi in core/
modules/ locale/ tests/ src/ Kernel/ LocaleStringTest.php - Tests Search API loading multiple objects.
File
-
core/
modules/ locale/ tests/ src/ Kernel/ LocaleStringTest.php, line 212
Class
- LocaleStringTest
- Tests the locale string storage, string objects and data API.
Namespace
Drupal\Tests\locale\KernelCode
protected function createAllTranslations(StringInterface $source, array $values = []) {
$list = [];
/** @var \Drupal\Core\Language\LanguageManagerInterface $language_manager */
$language_manager = $this->container
->get('language_manager');
foreach ($language_manager->getLanguages() as $language) {
$list[$language->getId()] = $this->createTranslation($source, $language->getId(), $values);
}
return $list;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.