File Extensions |
.xlf, .xliff |
API Extension |
symfony_xliff |
Import |
Yes |
Export |
Yes |
Plural forms support |
No |
Description support |
Yes |
Format options |
enclose_in_cdata include_translation_state |
Symfony is a high-performance PHP framework composed of various predefined PHP components. Localization for applications built with Symfony can take place with file formats such as .XLIFF, .YAML, and PHP Arrays.
The difference between a Symfony .XLIFF and a standard .XLIFF lies in how they locate what each <trans-unit>
represents. While standard .XLIFFs (and also most .XLIFF variations supported by other frameworks) use the id
attribute, Symfony .XLIFF uses the attribute resname
as the identifier.
To ensure that strings are uploaded to the correct locale, the target-language
attribute in the file header of a Symfony .XLIFF needs to match the locale name configured in the relevant project.
Format Options
Identifier |
enclose_in_cdata |
Type |
boolean |
Upload |
No |
Download |
Yes |
Default |
false |
Description |
Encloses translations containing html tags in CDATA. If disabled, unsupported HTML entities are replaced with their decoded values. For example:
|
Identifier |
include_translation_state |
Type |
boolean |
Upload |
No |
Download |
Yes |
Default |
false |
Description |
Include state of translations in the target locale. Every |
Code Sample
<?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! Dieser Schlüssel hat eine Beschreibung!</source> <target xml:lang="en-GB">Check it out! This key has a description! (At least in some formats)</target> <note>I'm a very important description for this key!</note> </trans-unit> <trans-unit id="key_with_line-break" resname="key_with_line-break"> <source xml:lang="de-DE">Diese Übersetzung hat einen Zeilenumbruch.</source> <target xml:lang="en-GB">This translations contains a line-break.</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">I'm a deeply nested key.</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">This key is nested inside a namespace.</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">--- - erstes Item - zweites Item </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">Just a simple key with a simple message.</target> </trans-unit> <trans-unit id="unverified_key" resname="unverified_key"> <source xml:lang="de-DE">Diese Übersetzung ist noch nicht bestätigt und wartet drauf!</source> <target xml:lang="en-GB">This translation is not yet verified and waits for it. (In some formats we also export this status)</target> </trans-unit> </body> </file> </xliff>