How to change the version of an XLIFF file?

698 Views Asked by At

I have translations for a project I am working on in an XLIFF file. I want to translate it to more languages using DeepL, but DeepL only supports XLIFF files with version 2.1 while the XLIFF files I am working with are version 1.2. Is there a way or a tool to change the version to 2.1? I am using XLIFF sync in VS Code, but it say it can only convert between 1.2 and 2.0.

I tried searching for tools and also VS Code extensions, that can do what I need, but could not find anything.

1

There are 1 best solutions below

1
Piotr Bienkowski On

If your tool can generate xliff 2.0, this might work for you. Try changing version="2.0" to version="2.1" at the top of the file. Also, languages should be defined in the same top element. Here is an example of a xliff 2.1 file that I got today from Deepl support, because I am also working on xliff file translation using Deepl API:

<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.1" srcLang="en" trgLang="pl">
    <file id="f1">
        <notes>
            <note id="n1">note for file.</note>
        </notes>
        <unit id="u1">
            <my:elem xmlns:my="myNamespaceURI" id="x1">data</my:elem>
            <notes>
                <note id="n1">note for unit</note>
            </notes>
            <segment id="s1">
                <source>
                    <pc id="1">Hello my wonderful and beautiful <mrk id="m1" type="term">World</mrk>!</pc>
                </source>
                <target>
                    <pc id="1">Witaj mój cudowny i piękny <mrk id="m1" type="term">świecie</mrk>!</pc>
                </target>
            </segment>
        </unit>
        <unit id="u2">
            <my:elem xmlns:my="myNamespaceURI" id="x1">data</my:elem>
            <notes>
                <note id="n2">note for unit</note>
            </notes>
            <segment id="s2">
                <source>
                    <pc id="2">This is the dark side of the <mrk id="m2" type="term">Moon</mrk>!</pc>
                </source>
                <target>
                    <pc id="2">To jest ciemna strona <mrk id="m2" type="term">Księżyca</mrk>!</pc>
                </target>
            </segment>
        </unit>
    </file>
</xliff>

Hope this helps.