diff --git a/src/Symfony/Component/Translation/CHANGELOG.md b/src/Symfony/Component/Translation/CHANGELOG.md index daab7fd3fc0e..c3b00a334c0d 100644 --- a/src/Symfony/Component/Translation/CHANGELOG.md +++ b/src/Symfony/Component/Translation/CHANGELOG.md @@ -6,6 +6,7 @@ CHANGELOG * The `FileDumper::setBackup()` method is deprecated and will be removed in 5.0. * The `TranslationWriter::disableBackup()` method is deprecated and will be removed in 5.0. + * The `XliffFileDumper` will write "name" on the "unit" node when dumping XLIFF 2.0. 4.0.0 ----- diff --git a/src/Symfony/Component/Translation/Dumper/XliffFileDumper.php b/src/Symfony/Component/Translation/Dumper/XliffFileDumper.php index d7e5ecc78c12..437a7f19b951 100644 --- a/src/Symfony/Component/Translation/Dumper/XliffFileDumper.php +++ b/src/Symfony/Component/Translation/Dumper/XliffFileDumper.php @@ -146,6 +146,7 @@ private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain, foreach ($messages->all($domain) as $source => $target) { $translation = $dom->createElement('unit'); $translation->setAttribute('id', strtr(substr(base64_encode(hash('sha256', $source, true)), 0, 7), '/+', '._')); + $translation->setAttribute('name', $source); $metadata = $messages->getMetadata($source, $domain); // Add notes section diff --git a/src/Symfony/Component/Translation/Tests/fixtures/resources-2.0-clean.xlf b/src/Symfony/Component/Translation/Tests/fixtures/resources-2.0-clean.xlf index 06047dde542f..efa69b27ffb5 100644 --- a/src/Symfony/Component/Translation/Tests/fixtures/resources-2.0-clean.xlf +++ b/src/Symfony/Component/Translation/Tests/fixtures/resources-2.0-clean.xlf @@ -1,19 +1,19 @@ - + foo bar - + key - + key.with.cdata & ]]> diff --git a/src/Symfony/Component/Translation/Tests/fixtures/resources-notes-meta.xlf b/src/Symfony/Component/Translation/Tests/fixtures/resources-notes-meta.xlf index e9995fa8474c..7d5bbd40f643 100644 --- a/src/Symfony/Component/Translation/Tests/fixtures/resources-notes-meta.xlf +++ b/src/Symfony/Component/Translation/Tests/fixtures/resources-notes-meta.xlf @@ -1,7 +1,7 @@ - + new true @@ -12,7 +12,7 @@ bar - + x_content Fuzzy