You are here

public function LocaleImportFunctionalTest::importPoFile in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/locale/src/Tests/LocaleImportFunctionalTest.php \Drupal\locale\Tests\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/src/Tests/LocaleImportFunctionalTest.php
Tests .po file import with configuration translation.
LocaleImportFunctionalTest::testConfigtranslationImportingPoFile in core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
Tests .po file import with user.settings configuration.
LocaleImportFunctionalTest::testCreatedLanguageTranslation in core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
Test the translation are imported when a new language is created.
LocaleImportFunctionalTest::testEmptyMsgstr in core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
Test empty msgstr at end of .po file see #611786.
LocaleImportFunctionalTest::testLanguageContext in core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
Test msgctxt context support.

... See full list

File

core/modules/locale/src/Tests/LocaleImportFunctionalTest.php, line 376
Contains \Drupal\locale\Tests\LocaleImportFunctionalTest.

Class

LocaleImportFunctionalTest
Tests the import of locale files.

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);
}