function LocaleImportFunctionalTest::importPoFile
Same name in other branches
- 7.x modules/locale/locale.test \LocaleImportFunctionalTest::importPoFile()
- 8.9.x core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php \Drupal\Tests\locale\Functional\LocaleImportFunctionalTest::importPoFile()
- 10 core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php \Drupal\Tests\locale\Functional\LocaleImportFunctionalTest::importPoFile()
- 11.x core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php \Drupal\Tests\locale\Functional\LocaleImportFunctionalTest::importPoFile()
Helper function: import a standalone .po file in a given language.
Parameters
string $contents: Contents of the .po file to import.
array $options: (optional) Additional options to pass to the translation import form.
6 calls to LocaleImportFunctionalTest::importPoFile()
- LocaleImportFunctionalTest::testConfigPoFile in core/
modules/ locale/ tests/ src/ Functional/ LocaleImportFunctionalTest.php - Tests .po file import with configuration translation.
- LocaleImportFunctionalTest::testConfigTranslationImportingPoFile in core/
modules/ locale/ tests/ src/ Functional/ LocaleImportFunctionalTest.php - Tests .po file import with user.settings configuration.
- LocaleImportFunctionalTest::testCreatedLanguageTranslation in core/
modules/ locale/ tests/ src/ Functional/ LocaleImportFunctionalTest.php - Tests the translation are imported when a new language is created.
- LocaleImportFunctionalTest::testEmptyMsgstr in core/
modules/ locale/ tests/ src/ Functional/ LocaleImportFunctionalTest.php - Tests empty msgstr at end of .po file see #611786.
- LocaleImportFunctionalTest::testLanguageContext in core/
modules/ locale/ tests/ src/ Functional/ LocaleImportFunctionalTest.php - Tests msgctxt context support.
File
-
core/
modules/ locale/ tests/ src/ Functional/ LocaleImportFunctionalTest.php, line 403
Class
- LocaleImportFunctionalTest
- Tests the import of locale files.
Namespace
Drupal\Tests\locale\FunctionalCode
public function importPoFile($contents, array $options = []) {
$file_system = \Drupal::service('file_system');
$name = $file_system->tempnam('temporary://', "po_") . '.po';
file_put_contents($name, $contents);
$options['files[file]'] = $name;
$this->drupalGet('admin/config/regional/translate/import');
$this->submitForm($options, 'Import');
$file_system->unlink($name);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.