function LocaleExportFunctionalTest::testExportTranslation
Test exportation of translations.
File
-
modules/
locale/ locale.test, line 1375
Class
- LocaleExportFunctionalTest
- Functional tests for the export of translation files.
Code
function testExportTranslation() {
// First import some known translations.
// This will also automatically enable the 'fr' language.
$name = drupal_tempnam('temporary://', "po_") . '.po';
file_put_contents($name, $this->getPoFile());
$this->drupalPost('admin/config/regional/translate/import', array(
'langcode' => 'fr',
'files[file]' => $name,
), t('Import'));
drupal_unlink($name);
// Get the French translations.
$this->drupalPost('admin/config/regional/translate/export', array(
'langcode' => 'fr',
), t('Export'));
// Ensure we have a translation file.
$this->assertRaw('# French translation of Drupal', 'Exported French translation file.');
// Ensure our imported translations exist in the file.
$this->assertRaw('msgstr "lundi"', 'French translations present in exported file.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.