You are here

public function LocaleImportFunctionalTest::testCreatedLanguageTranslation in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php \Drupal\Tests\locale\Functional\LocaleImportFunctionalTest::testCreatedLanguageTranslation()
  2. 9 core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php \Drupal\Tests\locale\Functional\LocaleImportFunctionalTest::testCreatedLanguageTranslation()

Tests the translation are imported when a new language is created.

File

core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php, line 387

Class

LocaleImportFunctionalTest
Tests the import of locale files.

Namespace

Drupal\Tests\locale\Functional

Code

public function testCreatedLanguageTranslation() {

  // Import a .po file to add de language.
  $this
    ->importPoFile($this
    ->getPoFileWithConfigDe(), [
    'langcode' => 'de',
  ]);

  // Get the language.entity.de label and check it's been translated.
  $override = \Drupal::languageManager()
    ->getLanguageConfigOverride('de', 'language.entity.de');
  $this
    ->assertEquals('Deutsch', $override
    ->get('label'));
}