支持文件类型 (Strings)

.XLIFF - Symfony (字符串)

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

文件扩展名 

.xlf, .xliff

API 扩展 

symfony_xliff

导入 

导出 

复数形式支持 

描述支持 

格式选项 

这些选项可以在文件上传和/或下载时指定。根据上传/下载方法(API、CLI、Repo同步等),它们可以在查询参数中指定 上传, 下载 或在 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 属性作为标识符。

为了确保字符串上传到正确的 区域,Symfony .XLIFF 文件头中的 目标语言 属性需要与相关项目中配置的区域名称匹配。

格式选项

标识符 

enclose_in_cdata

类型 

布尔值

上传 

下载 

默认 

false

说明 

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

  • &pound; 被替换为 £

  • &trade; 被替换为

标识符 

include_translation_state

类型 

布尔值

上传 

下载 

默认 

false

说明 

在目标区域包含翻译状态。每个 <target> 标签将获得一个 状态 属性,可能的值有:新建已签署已翻译

代码示例

<?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">看看这个!这个键有一个描述!</source>
        看看吧!这个键有一个描述!(至少在某些格式中)
        <注释>我对这个键非常重要的描述!</注释>
      </trans-unit>
      <trans-unit id="key_with_line-break" resname="key_with_line-break">
        <source xml:lang="de-DE">Diese Übersetzung hat
一个换行符。</原文>
        <译文 xml:lang="en-GB">这个翻译包含
一个换行符。</译文>
      </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>
        <译文 xml:lang="en-GB">我是一把深度嵌套的键。</译文>
      </trans-unit>
      <trans-unit id="nested.key" resname="nested.key">
        <source xml:lang="de-DE">Dieser Schlüssel ist innerhalb eines Namensraumes verschachtelt.</source>
        <译文 xml:lang="en-GB">这个键嵌套在一个命名空间内。</译文>
      </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">---
- 第一个条目
- 第二个条目
- 第三个条目
</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>
        <译文 xml:lang="en-GB">只是一个简单的键,带有简单的信息。</译文>
      </trans-unit>
      <trans-unit id="unverified_key" resname="unverified_key">
        <原文 xml:lang="de-DE">这个翻译尚未验证,正在等待!</原文>
        <译文 xml:lang="en-GB">这个翻译尚未验证,正在等待它。(在某些格式中,我们也导出这个状态)</译文>
      </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.