Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid order of target element in xlf12 #90

Closed
xfh opened this issue May 30, 2018 · 1 comment
Closed

Invalid order of target element in xlf12 #90

xfh opened this issue May 30, 2018 · 1 comment
Labels

Comments

@xfh
Copy link

xfh commented May 30, 2018

Hi

xliffmerge adds target tages automatically when they are not defined in the source file (as is the new default: angular/angular#21690).

However, it seems as the target tag is added as the last element of a translation unit. This is a violation of the XLIFF schema. <target> should come after <source> and before <context-group>.

Here is an example:

Source:

<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
  <file source-language="de-CH" datatype="plaintext" original="ng2.template">
    <body>
      <trans-unit id="error.email" datatype="html">
        <source>ungültige Email Adresse</source>
        <context-group purpose="location">
          <context context-type="sourcefile">app/shared/error/error.component.ts</context>
          <context context-type="linenumber">6</context>
        </context-group>
      </trans-unit>
    </body>
  </file>
</xliff>

Merged file:

<?xml version='1.0' encoding='UTF-8'?>
<xliff 
  xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
  <file source-language="de-CH" datatype="plaintext" original="ng2.template" target-language="de-CH">
    <body>
      <trans-unit id="error.email" datatype="html">
        <source>ungültige Email Adresse</source>
        <context-group purpose="location">
          <context context-type="sourcefile">app/shared/error/error.component.ts</context>
          <context context-type="linenumber">6</context>
        </context-group>
        <target state="new">ungültige Email Adresse</target>
      </trans-unit>
    </body>
  </file>
</xliff>

Expected:

<?xml version='1.0' encoding='UTF-8'?>
<xliff 
  xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
  <file source-language="de-CH" datatype="plaintext" original="ng2.template" target-language="de-CH">
    <body>
      <trans-unit id="error.email" datatype="html">
        <source>ungültige Email Adresse</source>
        <target state="new">ungültige Email Adresse</target>
        <context-group purpose="location">
          <context context-type="sourcefile">app/shared/error/error.component.ts</context>
          <context context-type="linenumber">6</context>
        </context-group>     
      </trans-unit>
    </body>
  </file>
</xliff>
@martinroob
Copy link
Owner

You are right. The xsd schema requires target element directly behind source.
The ng compiler does not care, so it is not a big issue.
But I wiĺl fix it as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants