protected function LocaleStringTest::createAllTranslations in Drupal 10
Same name and namespace in other branches
- 8 core/modules/locale/tests/src/Kernel/LocaleStringTest.php \Drupal\Tests\locale\Kernel\LocaleStringTest::createAllTranslations()
- 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.
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;
}