Skip to content

Commit ebf29fc

Browse files
[Form][Security][Validator] Normalize translation files
1 parent 4e5af84 commit ebf29fc

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Loader/XliffFileLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, s
111111
continue;
112112
}
113113

114+
if (isset($translation->target) && 'needs-translation' === (string) $translation->target->attributes()['state']) {
115+
continue;
116+
}
117+
114118
$source = isset($attributes['resname']) && $attributes['resname'] ? $attributes['resname'] : $translation->source;
115119
// If the xlf file has another encoding specified, try to convert it because
116120
// simple_xml will always return utf-8 encoded values

Tests/fixtures/resources.xlf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
<target>with</target>
1919
<note>note</note>
2020
</trans-unit>
21+
<trans-unit id="5">
22+
<source>skipped</source>
23+
<target state="needs-translation">skipped</target>
24+
</trans-unit>
2125
</body>
2226
</file>
2327
</xliff>

0 commit comments

Comments
 (0)