function LocalePluralFormatTest::importPoFile
Same name in other branches
- 9 core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php \Drupal\Tests\locale\Functional\LocalePluralFormatTest::importPoFile()
- 8.9.x core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php \Drupal\Tests\locale\Functional\LocalePluralFormatTest::importPoFile()
- 10 core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php \Drupal\Tests\locale\Functional\LocalePluralFormatTest::importPoFile()
- 11.x core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php \Drupal\Tests\locale\Functional\LocalePluralFormatTest::importPoFile()
Imports a standalone .po file in a given language.
Parameters
$contents: Contents of the .po file to import.
$options: Additional options to pass to the translation import form.
1 call to LocalePluralFormatTest::importPoFile()
- LocalePluralFormatTest::setUp in modules/
locale/ locale.test - Sets up a Drupal site for running functional and integration tests.
File
-
modules/
locale/ locale.test, line 856
Class
- LocalePluralFormatTest
- Tests plural index computation functionality.
Code
function importPoFile($contents, array $options = array()) {
$name = drupal_tempnam('temporary://', "po_") . '.po';
file_put_contents($name, $contents);
$options['files[file]'] = $name;
$this->drupalPost('admin/config/regional/translate/import', $options, t('Import'));
drupal_unlink($name);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.