支持文件类型 (Strings)

.XLIFF - XML 本地化交换文件格式 V2 (Strings)

文本由 Phrase Language AI 从英语机器翻译而得。

文件扩展名

.xlf, .xliff

API 扩展

xliff_2

导入

导出

复数形式支持

复数形式支持

格式选项

这些选项可在上传和/或下载文件时指定。根据上传/下载方法(API、CLI、Repo 同步等),它们可以在查询参数 上传下载phrase.yml 配置文件中指定。

ignore_source_translations, ignore_target_translations, override_file_language, enclose_in_cdata, include_translation_state

XLIFF 2.0 是对更常用的 XLIFF 1.2 的更新。

它是一种基于 XML 的变体,使用诸如 <source><target> 之类的标记来存储给定原文/源语文件的原文/源语和译文文本。此外,它还会提取包括变量、代码和注释在内的非译元素,并将它们保存在自定义元素中。  

与 XLIFF 1.2 相比,XLIFF 2.0 具有因组织更好的 DOM 结构和模块化应用而带来的简洁性优势。  

XLIFF 2.0 的 DOM 结构与 XLIFF 1.2 不同。这两种格式通常不兼容。

格式选项

标识符

ignore_source_translations

类型

布尔值

上传

下载

默认

false

说明

在上传期间略过文件中的原文/源语译文(以避免意外的原文/源语语言更新)

标识符

ignore_target_translations

类型

布尔值

上传

下载

默认

false

说明

在上传期间略过文件中的译文(以避免意外的译文语言更新)

标识符 

override_file_language

类型 

布尔值

上传 

下载 

默认 

false

说明 

此文件格式通常在文件本身中包含语言信息。使用此选项可覆盖语言为您指定的语言。

标识符 

enclose_in_cdata

类型 

布尔值

上传 

下载 

默认 

false

说明 

将包含 HTML 标记的译文括在 CDATA 中。如果禁用,不受支持的 HTML 实体将被替换为其解码值。例如:

  • &pound; 被替换为 £

  • &trade; 被替换为

代码示例

<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="2.0" xmlns="urn:oasis:names:tc:xliff:document:2.0" srcLang="en" trgLang="de">
  <file original="ng.template" id="ngi18n">
    <unit id="key_name">
      <notes>
        <note category="meaning">header</note>
        <note category="location">app/app.component.ts:2</note>
      </notes>
      <segment>
        <原文/源语>Hello</原文/源语>
        <译文>Hallo</译文>
      </segment>
    </unit>
  </file>
</xliff>

复数形式

复数键将使用以下语法导出:

<unit id="plural_key">
  <segment>
    <source>{"one":"a plural","other":"some plurals"}</source>
    <target>{"one":"ein Plural","other":"einige Plurale"}</target>
  </segment>
</unit>
这篇文章有帮助吗?

Sorry about that! In what way was it not helpful?

The article didn’t address my problem.
I couldn’t understand the article.
The feature doesn’t do what I need.
Other reason.

Note that feedback is provided anonymously so we aren't able to reply to questions.
If you'd like to ask a question, submit a request to our Support team.
Thank you for your feedback.