function LocalePluralFormatTest::importPoFile

7.x locale.test LocalePluralFormatTest::importPoFile($contents, array $options = array())

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 drupal-7.x/modules/locale/locale.test
Sets up a Drupal site for running functional and integration tests.

File

drupal-7.x/modules/locale/locale.test, line 811
Tests for locale.module.

Class

LocalePluralFormatTest
Tests plural index computation functionality.

Code

function importPoFile($contents, array $options = array()) {
  $name = 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);
}