Skip to content

XLIFF 1.2 parser fails on standard XLIFF files (Symfony, and likely others) #494

@Tomsgu

Description

@Tomsgu

This is a completely valid xliff 1.2 file. Generated by Symfony translation component:

<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
  <file source-language="fr" target-language="en" datatype="plaintext" original="file.ext">
    <header>
      <tool tool-id="symfony" tool-name="Symfony"/>
    </header>
    <body>
      <trans-unit id="eXcdCeC" resname="action.approve">
        <source>action.approve</source>
        <target>Approve</target>
      </trans-unit>
    </body>
  </file>
</xliff>

The accent parser seems to have the following issues:

  1. <xliff> root element is not supported. The current parser only works with a bare <file> as root, which is not valid XLIFF.
  2. Instead of ignoring the <header>, it fails to process anything.
  3. The parser doesn't like the resname optional attribute (silent fail) on trans-unit tag, which is used as a key in Symfony translation.
  4. Id is used as the translation key instead of resname. From the spec

Identifier - The id attribute is used in many elements as a reference to the original corresponding code data or format for the given element. The value of the id element is determined by the tool creating the XLIFF document. It may or may not be a resource identifier. The identifier of a resource should, at least, be stored in the resname attribute.

Note that export has the same issue: generating an invalid xliff 1.2 file.

Most likely the issue from #329

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions