File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
setup/src/Magento/Setup/Module/I18n/Parser/Adapter Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 16
16
class Xml extends AbstractAdapter
17
17
{
18
18
/**
19
- * { @inheritdoc}
19
+ * @inheritdoc
20
20
*/
21
21
protected function _parse ()
22
22
{
23
23
foreach ($ this ->_getNodes ($ this ->_file ) as $ key => $ element ) {
24
+
24
25
if (!$ element instanceof \SimpleXMLElement) {
25
26
continue ;
26
27
}
27
28
28
- $ attributes = ( string ) $ key === ' title ' ? $ element : $ element ->attributes ();
29
+ $ attributes = $ element ->attributes ();
29
30
30
- if ((string )$ attributes ['translate ' ] === 'true ' || (string )$ attributes ['translatable ' ] === 'true ' ) {
31
+ if ((string )$ attributes ['translate ' ] === 'true ' || (string )$ attributes ['translatable ' ] === 'true ' ) {
31
32
$ this ->_addPhrase ((string )$ element );
32
- } else if ( isset ( $ attributes -> title ) ) {
33
+ } elseif ( $ key === ' title ' ) {
33
34
$ this ->_addPhrase ((string )$ element ->title );
34
35
} else {
35
36
$ this ->parseTranslatableNodes ($ attributes , $ element );
@@ -53,10 +54,10 @@ protected function _getNodes($file)
53
54
$ nodes = $ xml ->xpath ('//*[@translate|@translatable] ' );
54
55
55
56
/* To add title of all xml files in translation csv */
56
- if ($ xml ->head ){
57
+ if ($ xml ->head ) {
57
58
$ nodes ['title ' ] = $ xml ->head ;
58
59
}
59
-
60
+
60
61
unset($ xml );
61
62
62
63
return is_array ($ nodes ) ? $ nodes : [];
You can’t perform that action at this time.
0 commit comments