Skip to content
Snippets Groups Projects
Commit b2b2a444 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2029505 by penyaskito, YesCT, Gábor Hojtsy: Fixed Exporting...

Issue #2029505 by penyaskito, YesCT, Gábor Hojtsy: Fixed Exporting translations does not correctly generate empty strings.
parent 486f5d03
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -256,8 +256,8 @@ private function formatPlural() {
*/
private function formatSingular() {
$output = '';
$output .= 'msgid '. $this->formatString($this->_source);
$output .= 'msgstr '. (isset($this->_translation) ? $this->formatString($this->_translation) : '');
$output .= 'msgid ' . $this->formatString($this->_source);
$output .= 'msgstr ' . (isset($this->_translation) ? $this->formatString($this->_translation) : '""');
return $output;
}
......
......@@ -113,8 +113,8 @@ function testExportTranslation() {
$this->assertRaw('# French translation of Drupal', t('Exported French translation file with only untranslated strings.'));
// Ensure no customized translations exist in the file.
$this->assertNoRaw('msgstr "janvier"', t('French custom translation not present in exported file.'));
// Ensure the untranslated strings exist in the file.
$this->assertRaw('msgid "February"', t('Untranslated string present in exported file.'));
// Ensure the untranslated strings exist in the file, and with right quotes.
$this->assertRaw($this->getUntranslatedString(), t('Empty string present in exported file.'));
}
/**
......@@ -165,6 +165,19 @@ function getCustomPoFile() {
msgid "January"
msgstr "janvier"
EOF;
}
/**
* Returns a .po file fragment with an untranslated string.
*
* @return string
* A .po file fragment with an untranslated string.
*/
function getUntranslatedString() {
return <<< EOF
msgid "February"
msgstr ""
EOF;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment