function LocaleImportFunctionalTest::testLanguageContext

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

Test msgctxt context support.

File

modules/locale/locale.test, line 1082

Class

LocaleImportFunctionalTest
Functional tests for the import of translation files.

Code

function testLanguageContext() {
    // Try importing a .po file.
    $this->importPoFile($this->getPoFileWithContext(), array(
        'langcode' => 'hr',
    ));
    $this->assertIdentical(t('May', array(), array(
        'langcode' => 'hr',
        'context' => 'Long month name',
    )), 'Svibanj', 'Long month name context is working.');
    $this->assertIdentical(t('May', array(), array(
        'langcode' => 'hr',
    )), 'Svi.', 'Default context is working.');
}

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