You are here

public function LocalePluralFormatTest::importPoFile in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/locale/src/Tests/LocalePluralFormatTest.php \Drupal\locale\Tests\LocalePluralFormatTest::importPoFile()

Imports a standalone .po file in a given language.

Parameters

string $contents: Contents of the .po file to import.

array $options: Additional options to pass to the translation import form.

3 calls to LocalePluralFormatTest::importPoFile()
LocalePluralFormatTest::testGetPluralFormat in core/modules/locale/src/Tests/LocalePluralFormatTest.php
Tests locale_get_plural() and \Drupal::translation()->formatPlural() functionality.
LocalePluralFormatTest::testPluralEditDateFormatter in core/modules/locale/src/Tests/LocalePluralFormatTest.php
Tests plural editing of DateFormatter strings
LocalePluralFormatTest::testPluralEditExport in core/modules/locale/src/Tests/LocalePluralFormatTest.php
Tests plural editing and export functionality.

File

core/modules/locale/src/Tests/LocalePluralFormatTest.php, line 345
Contains \Drupal\locale\Tests\LocalePluralFormatTest.

Class

LocalePluralFormatTest
Tests plural handling for various languages.

Namespace

Drupal\locale\Tests

Code

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