Everything you need to be made aware of XLIFF 2.0 and how it differs from its XLIFF 1.2 counterpart
File Extensions | .xlf, .xliff |
API Extension | xliff_2 |
Import | Yes |
Export | Yes |
Pluralization supported? | Yes |
Descriptions supported? | No |
Format Options | ignore_source_translations, ignore_target_translations |
XLIFF 2.0 is an update on the more commonly used XLIFF 1.2. Similar to its predecessor, it is an XML-based variation that uses tags such as “<source>”, “<target>” to store original and translated texts for a given source file. In addition, it also extracts non-translatable data including variables, codes, and comments and saves them in its customized elements.
Compared with XLIFF 1.2, XLIFF 2.0 has the advantage of simplicity, which comes from its better organized DOM structure and application of modularity.
Note: XLIFF 2.0 has a different DOM structure than XLIFF 1.2. Therefore, the two formats are most times incompatible.
Code Sample
<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="2.0" xmlns="urn:oasis:names:tc:xliff:document:2.0" srcLang="en" trgLang="de">
<file original="ng.template" id="ngi18n">
<unit id="key_name">
<notes>
<note category="meaning">header</note>
<note category="location">app/app.component.ts:2</note>
</notes>
<segment>
<source>Hello</source>
<target>Hallo</target>
</segment>
</unit>
</file>
</xliff>
Format Options
Identifier | ignore_source_translations |
Type | boolean |
Upload | Yes |
Download | No |
Default | false |
Description | Ignores the source translations in the file during the upload (to avoid accidental source language updates) |
Identifier | ignore_target_translations |
Type | boolean |
Upload | Yes |
Download | No |
Default | false |
Description | Ignores the target translations in the file during the upload (to avoid accidental target language updates) |
Plural forms
Pluralized keys will be exported using the following syntax:
<unit id="plural_key">
<segment>
<source>{"one":"a plural","other":"some plurals"}</source>
<target>{"one":"ein Plural","other":"einige Plurale"}</target>
</segment>
</unit>