📝 Note: File conversion to XLIFF format is only available on the Growth plan and up.
File Extension(s) | .xliff, .xlf, .xml |
i18n type(s) | XLIFF |
The XLIFF format is an industry-standard format for exchanging localization files (XML Localisation Interchange File Format).
Transifex currently supports a certain subset of the features XLIFF provides:
The
<group>
,<context-group>
,<context>
,<trans-unit>
,<source>
,<note>
and<target>
; elements are handled.
Any context data are handled.
Developer comments are supported in the following way and appear in the Web Editor as Developer Notes.:
```
<note from="developer">TRANSLATORS: please limit the page width to 79
characters here.
</note>
```Character limits are also supported where the attribute
maxwidth
should be a positive number, and thesize-unit
must be set to char.:```
<trans-unit id="1" maxwidth="30" size-unit="char"></trans-unit>
```References are also supported where each reference is mapped to two <context> elements, one specifying the source file (context-type attribute set to
sourcefile
) and the other representing the location in the source file ( context-type attribute set tolinenumber
). Each reference is also grouped in a <context-group> element, with the name attribute set to a value that must be unique within the enclosing <file> element and the purpose attribute set to location.```
<trans-unit datatype="html" id="576413276e4ee299f9a138e749b71e2f5b0d3ed5">
<source>Confirm email address</source>
<context-group name="po-reference-2" purpose="location">
<context context-type="sourcefile">simple.c</context>
<context context-type="linenumber">5</context>
</context-group>
</trans-unit>
```They appear as Occurrences in the Web Editor.
The "approved" attribute is also supported. It indicates whether a translation is final or has passed its final review.
```
<trans-unit approved="yes" id="1" xml:space="preserve">
<source>username</source>
<target>Nom d'utilisateur</target>
</trans-unit>
<trans-unit approved="no" id="2" xml:space="preserve">
<source>Email address</source>
<target>Adresse de courriel</target>
</trans-unit>
```
After uploading such a translation file where the approved attribute is included, the parser will behave as follows:
Entries with
approved="yes"
will be marked as translated in Transifex, having the translation text available in the translation string's area.
Entries with
approved="no"
will remain untranslated in Transifex. However, the text inside the<target>
elements will be considered a user suggestion and available under the suggestions tab in the editor.
Plural support
Plural data are handled in the following manner:
```
<group restype="x-gettext-plurals">
<trans-unit id="1[0]" xml:space="preserve">
<source>Your trial ends in 1 day</source>
</trans-unit>
<trans-unit id="1[1]" xml:space="preserve">
<source>Your trial ends in %@ days</source>
</trans-unit>
</group>
```
📝 Note: Do you want to find out more about plurals in Transifex? Please check here.
The following features are not supported:
Attributes of the above elements.
The
<alt-trans>
element.Binary elements, like
<bin-unit>
,<bin-source>
; and<bin-target>
.The
<glossary>
elements.Any other minor elements.
How to distinguish source and translation Files
XLIFF is a universal standard for translating across various systems. If a translation agency is supplying translations from their TMS so you can upload them into Transifex, you must ensure that the source file is uploaded into Transifex first. A source file is different than a translation file. The translation file contains <Target> references, whereas a source file does not. For example:
The following header belongs to a source file:
```
<file datatype="plaintext" original="en.lproj/Localizable.txt" source-language="en">
```The following header belongs to a translation file:
```
<file datatype="plaintext" original="en.lproj/Localizable.txt" source-language="en" target-language="fr">
```The example above shows that the translation file contains a target language, whereas the source file does not. Please note that an XLIFF file can contain multiple entries of this type.
The following XLIFF entry represents an untranslated string. Only untranslated strings can be found in a source file:
```
<trans-unit datatype="html" id="576413276e4ee299f9a138e749b71e2f5b0d3ed5">
<source>Confirm email address</source>
</trans-unit>
```The following XLIFF entry represents a translated string. Translated strings can only be found in a translation file:
```
<trans-unit datatype="html" id="576413276e4ee299f9a138e749b71e2f5b0d3ed5">
<source>Confirm email address</source>
<target>Confirmez l'adresse courriel</target>
</trans-unit>
```
Escaping characters
Even though the rich/raw option appears in the editor’s settings, the XLIFF file format handler does not support rich/raw mode.
For file formats that do not support rich/raw, all strings are exposed in the editor in the rich mode. Then, when the language files get compiled, they will be properly escaped (converted to raw) according to the file format's rules.
Examples can be found below:
During parsing, we unescape (convert from raw to rich):
```
||*Source file*||*Editor*||
|foo|foo|
|“foo”|“foo”|
|"foo"|"foo"|
|&quot;foo&quot;|"foo"|
|&foo&|PARSE ERROR|
|&foo&|&foo&|
|&amp;foo&amp;|&foo&|
```
During compiling, we escape (convert from rich to raw):
```
||*Editor*||*Language file*||
|foo|foo|
|"foo"|"foo"|
|"foo"|&quot;foo&quot;|
|&quot;foo&quot;|&amp;quot;foo&amp;quot;|
|&foo&|&foo&|
|&foo&|&amp;foo&amp;|
|&amp;foo&amp;|&amp;amp;foo&amp;amp;|
```
However, if the translation contains some special XLIFF tags (bpt, ept, it, ph, g, bx, ex, x, sub), we don't escape between the {{<}} and {{>}} symbols. For example:
```
||*Editor*||*Language file*||
|foo <x a="b">bar</x>|foo <x a="b">bar</x>|
|"foo" <x a="b">bar</x>|"foo" <x a="b">bar</x>|
|"foo" <x a="b">bar</x>|&quot;foo&quot; <x a="b">bar</x>|
|&quot;foo&quot; <x a="b">bar</x>|&amp;quot;foo&amp;quot; <x a="b">bar</x>|
|&foo& <x a="b">bar</x>|&foo& <x a="b">bar</x>|
|&foo& <x a="b">bar</x>|&amp;foo&amp; <x a="b">bar</x>|
|&amp;foo&amp; <x a="b">bar</x>|&amp;amp;foo&amp;amp; <x a="b">bar</x>|
```
Default placeholders
These are the default placeholders that you could have in your file, and they will be recognized:
match: ['%1$s', '%(key1)s', '%s', '%d', '%.2f', '%-5d', '%+2d']
Download Modes
The following table summarizes the behavior of XLIFF files for different download modes:
*The results are compatible with parser version 1.
Additional Information
💡Tip
Looking for more help? Get support from our Transifex Community Forum!
Find answers or post to get help from Transifex Support and our Community.