Open hansmaad opened 5 years ago
I figured out that it is a problem of \n
in the source file vs. \r\n
in the translation file (generated by TinyTranslator on Chrome Win10). The comparison here returns true:
https://github.com/martinroob/ngx-i18nsupport/blob/6a3e151071a5862ed9776a27cedb9d6cd4d129ff/projects/xliffmerge/src/xliffmerge/xliff-merge.ts#L378-L391
As a workaround I'm now using this npm script
"xi18n": "npm run xi18n:crlf && ng xi18n --i18n-locale de --output-path i18n && npm run xi18n:merge",
"xi18n:crlf": "crlf --set=LF src/i18n/*.xlf",
"xi18n:merge": "xliffmerge --profile xliffmerge.json en de"
Yes, this is clearly a bug. Thanks for already figuring out what the problem is. Will fix it soon.
Unfortunately still broken for me.
Check out this example master (with LF). The corresponing translation file has same
<?xml version="1.0" encoding="UTF-8" ?>
<!-- issue 128 when source is unchanged but has different line ending translation state should not change -->
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="de" datatype="plaintext" original="ng2.template">
<body>
<trans-unit id="issue128" datatype="html">
<source>
Erste Zeile.
Zweite Zeile.
</source>
<context-group purpose="location">
<context context-type="sourcefile">awesome.component.html</context>
<context context-type="linenumber">2</context>
</context-group>
</trans-unit>
</body>
</file>
</xliff>
Hi, if I understood correctly, the state should switch from
final
totranslated
, when the source changed. If nothing changed, the translation is untouched.Please check this simple example, which will always set the state back to
translated
after setting the target state tofinal
.messages.xlf
messages.en.xlf
If you remove whitespace from the source and target, it works as expected:
messages.xlf
I'm using this profile