protected function LocaleStringTest::createAllTranslations in Drupal 8
Same name and namespace in other branches
- 9 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 - Test CRUD API.
- LocaleStringTest::testStringSearchApi in core/
modules/ locale/ tests/ src/ Kernel/ LocaleStringTest.php - Test Search API loading multiple objects.
File
- core/
modules/ locale/ tests/ src/ Kernel/ LocaleStringTest.php, line 206
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 $language_manager \Drupal\Core\Language\LanguageManagerInterface */
$language_manager = $this->container
->get('language_manager');
foreach ($language_manager
->getLanguages() as $language) {
$list[$language
->getId()] = $this
->createTranslation($source, $language
->getId(), $values);
}
return $list;
}