weblate icon indicating copy to clipboard operation
weblate copied to clipboard

XLIFF wrong formatting

Open martinpucik opened this issue 10 years ago • 5 comments

Steps to reproduce

  1. XLIFF based component
  2. Change translation for non-source language
  3. Save and commit

Actual behaviour

After saving new translation, there is added a new trans-unit to that language XLIFF file. But instead of adding <trans-unit></trans-unit> node, the new node is in format:

<ns0:trans-unit xmlns:ns0="urn:oasis:names:tc:xliff:document:1.2" id="id_of_unit" approved="no">
    <ns0:source>Source String</ns0:source>
    <ns0:target state="needs-translation">Translation</ns0:target>
</ns0:trans-unit>

Also its being ignored, that trans-unit with that id already exists in XLIFF file with standard format.

Expected behaviour

If there is not an trans-unit node with that id, add a standard ` node. If there is an node with that id, update that node.

Server configuration

Weblate v2.6


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

martinpucik avatar May 19 '16 13:05 martinpucik

Can you please include header of your xliff files as well? Also what version of transalate-toolkit do you have installed?

nijel avatar May 20 '16 07:05 nijel

Header for all XLIFF files looks like this:

<?xml version='1.0' encoding='utf-8'?>
<xliff version="1.2" schemaLocation="urn:oasis:names:tc:xliff:document:1.2 http://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd">

I'll add version of translate-toolkit later. Thanks.

martinpucik avatar May 20 '16 08:05 martinpucik

Okay, I think the problem is that <xliff> tag lacks namespace. This makes it pretty much invalid file and translate-toolkit thus doesn't see the translaitons there as there are none there in the xliff namespace.

The header should IMHO look like:

<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">

nijel avatar May 20 '16 11:05 nijel

Ok, thanks for your response.

I changed the header for the base (en.xliff) file and the new translations is being added with correct trans-unit tag.

But one issue still presists. After saving translation, it is added as a new trans-unit even if there already is a trans-unit with that given id.

Deleting all translation xliffs and creating new ones from base en.xliff did solve this.

martinpucik avatar May 23 '16 19:05 martinpucik

Didn't the other files have same header as well?

nijel avatar May 24 '16 06:05 nijel