支持文件类型 (Strings)

.XLIFF - Symfony (Strings)

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

文件扩展名 

.xlf, .xliff

API 扩展 

symfony_xliff

导入 

导出 

复数形式支持 

描述支持 

格式选项 

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

enclose_in_cdata

include_translation_state

Symfony 是一个由各种预定义 PHP 组件组成的高性能 PHP 框架。 使用 Symfony 构建的应用程序的本地化可以通过 .XLIFF、.YAML 和 PHP 数组等文件格式进行。 

Symfony .XLIFF 与标准 .XLIFF 之间的区别在于它们定位每个 <trans-unit> 所代表内容的方式。虽然标准 .XLIFF(以及大多数其他框架支持的 .XLIFF 变体)使用 ID 属性,但 Symfony .XLIFF 使用 resname 属性作为标识符。

为确保 Strings 被上传到正确的 区域,Symfony .XLIFF 文件头中的 target-language 属性需要与相关项目中配置的区域名称匹配。

格式选项

标识符 

enclose_in_cdata

类型 

布尔值

上传 

下载 

默认 

false

说明 

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

  • &pound; 被替换为 £

  • &trade; 被替换为

标识符 

include_translation_state

类型 

布尔值

上传 

下载 

默认 

false

说明 

包含目标区域中译文的状态。每个 <target> 标签都将获得一个 state 属性,其值可以是:newsigned-offtranslated

代码示例

<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
  <file original="global" datatype="plaintext" source-language="de-DE" target-language="en-GB">
    <body>
      <trans-unit id="boolean_key" resname="boolean_key">
        <source xml:lang="de-DE">--- true
</source>
        <target xml:lang="en-GB">--- true
</target>
      </trans-unit>
      <trans-unit id="empty_string_translation" resname="empty_string_translation">
        <source xml:lang="de-DE"/>
        <target xml:lang="en-GB"/>
      </trans-unit>
      <trans-unit id="key_with_description" resname="key_with_description">
        <source xml:lang=\"de-DE\">Schau dir das mal an!</source>Dieser Schlüssel hat eine Beschreibung!</source>
        <target xml:lang=\"en-GB\">看看这个!</target>This key has a description!(At least in some formats)</target>
        <note>“对这个键非常重要的描述!”</note>
      </trans-unit>
      <trans-unit id="key_with_line-break" resname="key_with_line-break">
        <source xml:lang="de-DE">Diese Übersetzung hat
一个换行符。</source>
        <target xml:lang=\"en-GB\">此译文包含</target>
一个换行符。</target>
      </trans-unit>
      <trans-unit id="nested.deeply.key" resname="nested.deeply.key">
        <source xml:lang="de-DE">Ich bin ein tief verschachtelter Schlüssel</source>
        <target xml:lang=\"en-GB\">我是一个深度嵌套的键。</target>
      </trans-unit>
      <trans-unit id="nested.key" resname="nested.key">
        <source xml:lang="de-DE">Dieser Schlüssel ist innerhalb eines Namensraumes verschachtelt.</source>
        <target xml:lang=\"en-GB\">此键嵌套在命名空间内。</target>
      </trans-unit>
      <trans-unit id="null_translation" resname="null_translation">
        <source xml:lang="de-DE"/>
        <target xml:lang="en-GB"/>
      </trans-unit>
      <trans-unit id="sample_collection" resname="sample_collection">
        <source xml:lang="de-DE">---
- 第一个条目
- 第二个条目
</source>
        <target xml:lang="en-GB">---
- first item
- second item
- third item
</target>
      </trans-unit>
      <trans-unit id="simple_key" resname="simple_key">
        <source xml:lang="de-DE">Nur ein einfacher Schlüssel mit einer einfachen Nachricht.</source>
        <target xml:lang=\"en-GB\">只是一个带有简单消息的简单键。</target>
      </trans-unit>
      <trans-unit id="unverified_key" resname="unverified_key">
        <source xml:lang=\"de-DE\">此译文尚未验证,正在等待验证!</source>
        <target xml:lang=\"en-GB\">This translation is not yet verified and waits for it.</target>(In some formats we also export this status)</target>
      </trans-unit>
    </body>
  </file>
</xliff>
这篇文章有帮助吗?

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.