protected function BambooTwigI18nTest::setUpTranslations in Bamboo Twig 8.5
Same name and namespace in other branches
- 8.3 tests/src/Functional/BambooTwigI18nTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigI18nTest::setUpTranslations()
- 8.4 tests/src/Functional/BambooTwigI18nTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigI18nTest::setUpTranslations()
Sets up translations strings needed for test.
1 call to BambooTwigI18nTest::setUpTranslations()
- BambooTwigI18nTest::setUp in tests/
src/ Functional/ BambooTwigI18nTest.php
File
- tests/
src/ Functional/ BambooTwigI18nTest.php, line 43
Class
- BambooTwigI18nTest
- Tests I18n twig filters and functions.
Namespace
Drupal\Tests\bamboo_twig\FunctionalCode
protected function setUpTranslations() {
/** @var \Drupal\locale\StringStorageInterface $localStorage */
$localStorage = $this->container
->get('locale.storage');
$thursday = $localStorage
->createString([
'source' => 'Thursday',
]);
$thursday
->save();
$this->translationsStrings[] = $localStorage
->createTranslation([
'lid' => $thursday->lid,
'language' => 'fr',
'translation' => 'Jeudi',
])
->save();
$thu = $localStorage
->createString([
'source' => 'Thu',
]);
$thu
->save();
$this->translationsStrings[] = $localStorage
->createTranslation([
'lid' => $thu->lid,
'language' => 'fr',
'translation' => 'Jeu',
])
->save();
$july = $localStorage
->createString([
'source' => 'July',
'context' => 'Long month name',
]);
$july
->save();
$this->translationsStrings[] = $localStorage
->createTranslation([
'lid' => $july->lid,
'language' => 'fr',
'translation' => 'Juillet',
])
->save();
}