首页>开发手册>Symfony>The XLIFF Format
Symfony 手册目录展开/收起

Symfony 7.4 LTS

The XLIFF Format

本文目录展开

官方英文资料(未自动翻译);本文按官方对应版本整理,保留说明和代码。站内处理包括移除站点导航、还原代码格式及调整链接。

Most professional translation tools support XLIFF. These files use the XML format and are supported by Symfony by default. Besides supporting all Symfony translation features, the XLIFF format also has some specific features.

Adding Notes to Translation Contents

Sometimes translators need additional context to better decide how to translate some content. This context can be provided with notes, which are a collection of comments used to store end user readable information. The only format that supports loading and dumping notes is XLIFF version 2.

If the XLIFF 2.0 document contains <notes> nodes, they are automatically loaded/dumped inside a Symfony application:

<?xml version="1.0" encoding="UTF-8" ?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0"
    srcLang="fr-FR" trgLang="en-US">
    <file id="messages.en_US">
        <unit id="LCa0a2j" name="original-content">
            <notes>
                <note category="state">new</note>
                <note category="approved">true</note>
                <note category="section" priority="1">user login</note>
            </notes>
            <segment state="translated" subState="Some custom value">
                <source>original-content</source>
                <target>translated-content</target>
            </segment>
        </unit>
    </file>
</xliff>

7.2

The support of attributes in the <segment> element was introduced in Symfony 7.2.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.
TOC
Version

来源与许可

Symfony documentation contributors。本资料采用 CC BY-SA 3.0;本页为官方资料的站内整理版本,并非框架官方网站。 许可说明

Symfony 官方文档 · 原文来源 · 打开在线代码运行