8000 feature #26149 Added support for name on the unit node (Nyholm) · symfony/symfony@b0facfe · GitHub
[go: up one dir, main page]

Skip to content

Commit b0facfe

Browse files
committed
feature #26149 Added support for name on the unit node (Nyholm)
This PR was squashed before being merged into the 4.1-dev branch (closes #26149). Discussion ---------- Added support for name on the unit node | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #25758 | License | MIT | Doc PR | na See [unit specification](http://docs.oasis-open.org/xliff/xliff-core/v2.0/os/xliff-core-v2.0-os.html#unit) and [name specification](http://docs.oasis-open.org/xliff/xliff-core/v2.0/os/xliff-core-v2.0-os.html#name) Commits ------- 30a22aa Added support for name on the unit node
2 parents bf24341 + 30a22aa commit b0facfe

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

src/Symfony/Component/Translation/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG
66

77
* The `FileDumper::setBackup()` method is deprecated and will be removed in 5.0.
88
* The `TranslationWriter::disableBackup()` method is deprecated and will be removed in 5.0.
9+
* The `XliffFileDumper` will write "name" on the "unit" node when dumping XLIFF 2.0.
910

1011
4.0.0
1112
-----

src/Symfony/Component/Translation/Dumper/XliffFileDumper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain,
146146
foreach ($messages->all($domain) as $source => $target) {
147147
$translation = $dom->createElement('unit');
148148
$translation->setAttribute('id', strtr(substr(base64_encode(hash('sha256', $source, true)), 0, 7), '/+', '._'));
149+
$translation->setAttribute('name', $source);
149150
$metadata = $messages->getMetadata($source, $domain);
150151

151152
// Add notes section

src/Symfony/Component/Translation/Tests/fixtures/resources-2.0-clean.xlf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="fr-FR" trgLang="en-US">
33
<file id="messages.en_US">
4-
<unit id="LCa0a2j">
4+
<unit id="LCa0a2j" name="foo">
55
<segment>
66
<source>foo</source>
77
<target>bar</target>
88
</segment>
99
</unit>
10-
<unit id="LHDhK3o">
10+
<unit id="LHDhK3o" name="key">
1111
<segment>
1212
<source>key</source>
1313
<target order="1"></target>
1414
</segment>
1515
</unit>
16-
<unit id="2DA_bnh">
16+
<unit id="2DA_bnh" name="key.with.cdata">
1717
<segment>
1818
<source>key.with.cdata</source>
1919
<target><![CDATA[<source> & <target>]]></target>

src/Symfony/Component/Translation/Tests/fixtures/resources-notes-meta.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="fr-FR" trgLang="en-US">
33
<file id="messages.en_US">
4-
<unit id="LCa0a2j">
4+
<unit id="LCa0a2j" name="foo">
55
<notes>
66
<note category="state">new</note>
77
<note category="approved">true</note>
@@ -12,7 +12,7 @@
1212
<target>bar</target>
1313
</segment>
1414
</unit>
15-
<unit id="uqWglk0">
15+
<unit id="uqWglk0" name="baz">
1616
<notes>
1717
<note id="x">x_content</note>
1818
<note appliesTo="target" category="quality">Fuzzy</note>

0 commit comments

Comments
 (0)
0