1 locale.test LocaleImportFunctionalTest::importPoFile($contents, array $options = array())

Helper function: import 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.

File

core/modules/locale/tests/locale.test, line 967
Tests for locale.module.

Class

LocaleImportFunctionalTest
Functional tests for the import of translation files.

Code

function importPoFile($contents, array $options = array()) {
  $name = backdrop_tempnam('temporary://', "po_") . '.po';
  file_put_contents($name, $contents);
  $options['files[file]'] = $name;
  $this->backdropPost('admin/config/regional/translate/import', $options, t('Import'));
  backdrop_unlink($name);
}