function LocaleImportFunctionalTest::testCreatedLanguageTranslation

Same name in other branches
  1. 9 core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php \Drupal\Tests\locale\Functional\LocaleImportFunctionalTest::testCreatedLanguageTranslation()
  2. 8.9.x core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php \Drupal\Tests\locale\Functional\LocaleImportFunctionalTest::testCreatedLanguageTranslation()
  3. 11.x 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 388

Class

LocaleImportFunctionalTest
Tests the import of locale files.

Namespace

Drupal\Tests\locale\Functional

Code

public function testCreatedLanguageTranslation() : void {
    // 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'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.