daniel-sc/ng-extract-i18n-merge

approved xml attribute is getting removed when running extract-i18n-merge

Closed this issue · 2 comments

Describe the bug
Hello
I'm using Weblate to translate, which is using an XML attribute approved="yes" on the trans-unit XML tag to set a trans-unit as approved.
I was using a previous version of ng-extract-18n-merge (1.4.0), and when running extract-i18n-merge, the attribute approved="yes" remained, which is the expected behavior.

<trans-unit id="1216022980126830102" datatype="html" approved="yes">
        <source>Language</source>
        <target state="final">Langue</target>
        <note priority="1" from="description">Label separator for lang in translate fields</note>
        <note priority="1" from="meaning">label separator</note>
        <context-group purpose="location">
          <context context-type="sourcefile">translation.component.html</context>
          <context context-type="linenumber">19</context>
        </context-group>
</trans-unit>

I updated ng-extract-i18n-merge to version 2.11.0, and now with the same scenario, the approved="yes" attribute is getting removed even if the state="final" remains. I would expect approved="yes" also to remain, as weblate is relying on that, overwise all translations states switch back to need review. But I'm getting this :

<trans-unit id="1216022980126830102" datatype="html">
      <source>Language</source>
      <target state="final">Langue</target>
      <note priority="1" from="description">Label separator for lang in translate fields</note>
      <note priority="1" from="meaning">label separator</note>
      <context-group purpose="location">
        <context context-type="sourcefile">translation.component.html</context>
        <context context-type="linenumber">19</context>
      </context-group>
</trans-unit>

Thank you in advance for your help.

@danjor thanks for raising this issue! Would you be able to hint if there are other (relevant) attributes that should be kept and if the same applies to XLF 2.0?

@daniel-sc Well, thank you for your reply.
For what I know and what I noticed, this is the only attribute that really matters, especially for Weblate to identify a trans-unit as approved, as it is not using the state attribute for that purpose. https://docs.weblate.org/en/latest/formats/xliff.html#translation-states.

Also, I'm using XLF 1.2, as XLF 2.0 is currently not supported by Weblate.