XLIFF 2.0

Added in version 5.15.

在 2026.9 版本发生变更.

备注

我们正在开发对这种格式的支持。某些功能也许上不可用,且不同版本间的行为也不一样。欢迎从测试得来的反馈。

备注

XLIFF 1.1 和 1.2 是不同的格式,不兼容 XLIFF 2.0。

基于 XML 的格式,为标准化翻译文件而生,但最终它也只是这个领域的 众多标准 之一。

XML 本地化交换语言格式 (XLIFF) 2.0 目前只支持用作双语言格式。

Weblate supports XLIFF 2.0 as a single file format. Placeables handling is controlled by the xliff_placeables 文件格式参数:

  • Plain text — escape XML elements in the content (the historical default for existing XLIFF 2.0 components).

  • Placeables — preserve placeables and other XML elements (the default for new components). Tags then appear as placeholders in the editor.

示例文件

示例 XLIFF 文件:

<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en" trgLang="cs">
  <file id="translation">
    <unit id="hello">
      <segment>
        <source xml:space="preserve">Hello, world!
</source>
        <target xml:space="preserve">Ahoj světe!
</target>
      </segment>
    </unit>
    <unit id="orangutan">
      <segment>
        <source xml:space="preserve">Orangutan has %d banana.
</source>
      </segment>
    </unit>
    <unit id="weblate">
      <segment>
        <source xml:space="preserve">Try Weblate at &lt;https://demo.weblate.org/&gt;!
</source>
      </segment>
    </unit>
    <unit id="thanks">
      <segment>
        <source>Thank you for using Weblate.</source>
      </segment>
    </unit>
  </file>
</xliff>
支持的功能

文件扩展名

.xlf, .xliff

Linguality ⓘ

双语

支持复数 ⓘ

Yes

支持描述 ⓘ

Yes

支持解释 ⓘ

No

支持上下文 ⓘ

Yes

支持位置 ⓘ

Yes

支持标记 ⓘ

Yes

额外状态 ⓘ

已核准, 需要编辑

API 标识符

xliff2

支持只读字符串 ⓘ

Yes

支持删除过时字符串 ⓘ

No

Weblate 配置

典型的 Weblate 部件配置

文件掩码

localizations/*.xliff

单语言译文模版语言文件

空

新语种的翻译模版

localizations/en-US.xliff

文件格式

XLIFF 2.0 翻译文件