Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 41c5af8

Browse files
committed
MAGETWO-67048: Cannot add translate attribute into the di.xml
1 parent e76d369 commit 41c5af8

File tree

1 file changed

+26
-14
lines changed
  • setup/src/Magento/Setup/Module/I18n/Parser/Adapter

1 file changed

+26
-14
lines changed

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

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,7 @@ protected function _parse()
2828
if ((string)$attributes['translate'] === 'true' || (string)$attributes['translatable'] === 'true') {
2929
$this->_addPhrase((string)$element);
3030
} else {
31-
$nodesDelimiter = strpos($attributes['translate'], ' ') === false ? ',' : ' ';
32-
foreach (explode($nodesDelimiter, $attributes['translate']) as $value) {
33-
$phrase = (string)$element->{$value};
34-
if ($phrase) {
35-
$this->_addPhrase($phrase);
36-
}
37-
$elementAttributes = $element->attributes();
38-
if (isset($elementAttributes[$value])) {
39-
$phrase = (string)$elementAttributes[$value];
40-
if ($phrase) {
41-
$this->_addPhrase($phrase);
42-
}
43-
}
44-
}
31+
$this->parseTranslatableNodes($attributes, $element);
4532
}
4633
}
4734
}
@@ -66,4 +53,29 @@ protected function _getNodes($file)
6653

6754
return [];
6855
}
56+
57+
/**
58+
* Parse nodes pointed out in attribute "translate".
59+
*
60+
* @param $attributes
61+
* @param $element
62+
* @return void
63+
*/
64+
protected function parseTranslatableNodes($attributes, $element)
65+
{
66+
$nodesDelimiter = strpos($attributes['translate'], ' ') === false ? ',' : ' ';
67+
foreach (explode($nodesDelimiter, $attributes['translate']) as $value) {
68+
$phrase = (string)$element->{$value};
69+
if ($phrase) {
70+
$this->_addPhrase($phrase);
71+
}
72+
$elementAttributes = $element->attributes();
73+
if (isset($elementAttributes[$value])) {
74+
$phrase = (string)$elementAttributes[$value];
75+
if ($phrase) {
76+
$this->_addPhrase($phrase);
77+
}
78+
}
79+
}
80+
}
6981
}

0 commit comments

Comments
 (0)