You are here

public function LocaleImportFunctionalTest::testConfigTranslationImportingPoFile 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::testConfigtranslationImportingPoFile()
  2. 9 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 370

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
    ->assertEquals('Anonymous German', $config
    ->get('anonymous'));
}