@@ -111,16 +111,20 @@ private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, s
111
111
continue ;
112
112
}
113
113
114
- if (isset ($ translation ->target ) && 'needs-translation ' === (string ) $ translation ->target ->attributes ()['state ' ]) {
114
+ $ source = (string ) (isset ($ attributes ['resname ' ]) && $ attributes ['resname ' ] ? $ attributes ['resname ' ] : $ translation ->source );
115
+
116
+ if (isset ($ translation ->target )
117
+ && 'needs-translation ' === (string ) $ translation ->target ->attributes ()['state ' ]
118
+ && \in_array ((string ) $ translation ->target , [$ source , (string ) $ translation ->source ], true )
119
+ ) {
115
120
continue ;
116
121
}
117
122
118
- $ source = isset ($ attributes ['resname ' ]) && $ attributes ['resname ' ] ? $ attributes ['resname ' ] : $ translation ->source ;
119
123
// If the xlf file has another encoding specified, try to convert it because
120
124
// simple_xml will always return utf-8 encoded values
121
125
$ target = $ this ->utf8ToCharset ((string ) ($ translation ->target ?? $ translation ->source ), $ encoding );
122
126
123
- $ catalogue ->set (( string ) $ source , $ target , $ domain );
127
+ $ catalogue ->set ($ source , $ target , $ domain );
124
128
125
129
$ metadata = [
126
130
'source ' => (string ) $ translation ->source ,
@@ -143,7 +147,7 @@ private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, s
143
147
$ metadata ['id ' ] = (string ) $ attributes ['id ' ];
144
148
}
145
149
146
- $ catalogue ->setMetadata (( string ) $ source , $ metadata , $ domain );
150
+ $ catalogue ->setMetadata ($ source , $ metadata , $ domain );
147
151
}
148
152
}
149
153
}
0 commit comments