如何更改 XLIFF 文件的版本?

问题描述 投票:0回答:1

我正在 XLIFF 文件中处理一个项目的翻译。我想使用 DeepL 将其翻译为更多语言,但 DeepL 仅支持版本 2.1 的 XLIFF 文件,而我正在使用的 XLIFF 文件是版本 1.2。有没有办法或工具可以将版本更改为2.1?我在 VS Code 中使用 XLIFF 同步,但它说只能在 1.2 和 2.0 之间转换。

我尝试搜索可以满足我需要的工具和 VS Code 扩展,但找不到任何东西。

xml translation xliff
1个回答
0
投票

如果您的工具可以生成 xliff 2.0,这可能适合您。尝试将文件顶部的 version="2.0" 更改为 version="2.1"。此外,语言应该在同一顶部元素中定义。这是我今天从 Deepl 支持处获得的 xliff 2.1 文件的示例,因为我也在使用 Deepl API 进行 xliff 文件翻译:

<?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>

希望这有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.