You are here

public function LocaleImportFunctionalTest::testCreatedLanguageTranslation in Drupal 8

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

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

File

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

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
    ->assertEqual($override
    ->get('label'), 'Deutsch');
}