Skip to content

Commit 69e06c4

Browse files
author
Oleksii Korshenko
authored
MAGETWO-82650: MAGETWO-77673: <![CDATA[]]>in system.xml translate phrase not work, if comment starts from new line[port from 2.2-develop] #11679
2 parents 7d27e5f + 9860b89 commit 69e06c4

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

setup/src/Magento/Setup/Module/I18n/Parser/Adapter/Xml.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private function parseTranslatableNodes(\SimpleXMLElement $attributes, \SimpleXM
6565
{
6666
$nodesDelimiter = strpos($attributes['translate'], ' ') === false ? ',' : ' ';
6767
foreach (explode($nodesDelimiter, $attributes['translate']) as $value) {
68-
$phrase = (string)$element->{$value};
68+
$phrase = trim((string)$element->{$value});
6969
if ($phrase) {
7070
$this->_addPhrase($phrase);
7171
}

setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/XmlTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public function parseDataProvider()
5353
['phrase' => 'Phrase 2', 'file' => $default, 'line' => '', 'quote' => ''],
5454
['phrase' => 'Phrase 3', 'file' => $default, 'line' => '', 'quote' => ''],
5555
['phrase' => 'Phrase 1', 'file' => $default, 'line' => '', 'quote' => ''],
56+
['phrase' => 'Comment from new line.', 'file' => $default, 'line' => '', 'quote' => ''],
5657
],
5758
],
5859
[

setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/_files/default.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@
1515
<node2>
1616
<title translate="true">Phrase 1</title>
1717
</node2>
18+
<node3 translate="comment">
19+
<comment>
20+
<![CDATA[Comment from new line.]]>
21+
</comment>
22+
</node3>
1823
</layout>

0 commit comments

Comments
 (0)