function LocaleImportFunctionalTest::testConfigtranslationImportingPoFile

Same name in other branches
  1. 9 core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php \Drupal\Tests\locale\Functional\LocaleImportFunctionalTest::testConfigTranslationImportingPoFile()
  2. 10 core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php \Drupal\Tests\locale\Functional\LocaleImportFunctionalTest::testConfigTranslationImportingPoFile()
  3. 11.x core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php \Drupal\Tests\locale\Functional\LocaleImportFunctionalTest::testConfigTranslationImportingPoFile()

Tests .po file import with user.settings configuration.

File

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

Class

LocaleImportFunctionalTest
Tests the import of locale files.

Namespace

Drupal\Tests\locale\Functional

Code

public function testConfigtranslationImportingPoFile() {
    // Set the language code.
    $langcode = 'de';
    // Import a .po file to translate.
    $this->importPoFile($this->getPoFileWithConfigDe(), [
        'langcode' => $langcode,
    ]);
    // Check that the 'Anonymous' string is translated.
    $config = \Drupal::languageManager()->getLanguageConfigOverride($langcode, 'user.settings');
    $this->assertEqual($config->get('anonymous'), 'Anonymous German');
}

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