|
文件扩展名 |
.xlf, .xliff |
|
API 扩展 |
symfony_xliff |
|
导入 |
是 |
|
导出 |
是 |
|
复数形式支持 |
否 |
|
描述支持 |
是 |
|
格式选项 这些选项可以在文件上传和/或下载时指定。根据上传/下载方法(API、CLI、Repo同步等),它们可以在查询参数 |
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实体将被替换为其解码值。例如:
|
|
标识符 |
include_translation_state |
|
类型 |
布尔值 |
|
上传 |
否 |
|
下载 |
是 |
|
默认 |
false |
|
说明 |
包含目标区域中翻译的状态。每个 |
代码示例
<?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="zh-CN">看看这个!这个键有一个描述!</source>
<target xml:lang="zh-CN">检查一下!This key has a description!(至少在某些格式中)</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="zh-CN">这个翻译包含
a line-break.</target>
</trans-unit>
<trans-unit id="nested.deeply.key" resname="nested.deeply.key">
<source xml:lang="zh-CN">我是一把深层嵌套的键</source>
<target xml:lang="zh-CN">我是一把深层嵌套的键。</target>
</trans-unit>
<trans-unit id="nested.key" resname="nested.key">
<source xml:lang="zh-CN">这个键嵌套在一个命名空间内。</source>
<target xml:lang="zh-CN">这个键嵌套在一个命名空间内。</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">这只是一个简单的键和一条简单的消息。</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">这条翻译尚未验证,正在等待确认。(在某些格式中,我们也导出此状态)
</trans-unit>
</body>
</file>
</xliff>