What is XLIFF?
XLIFF (XML Localization Interchange File Format) is an XML-based open standard designed to store localizable data and carry it between different steps of the localization process. Standardized by OASIS, XLIFF enables the exchange of translatable content between different tools, regardless of the original file format.
Unlike TMX which stores completed translations, XLIFF is designed as a working format for the active translation process, carrying source content, translations, and workflow metadata.
XLIFF Versions
XLIFF 1.2 (2008)
The most widely adopted version:
- Mature and stable specification
- Broad tool support
- Extensive inline element support
- Still the industry workhorse
XLIFF 2.0 (2014) / 2.1 (2018)
Modern redesign with modular architecture:
- Cleaner, simpler core
- Modular extensions
- Better defined semantics
- Growing adoption
XLIFF Structure
Basic XLIFF 1.2 Structure
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" target-language="de"
datatype="plaintext" original="example.txt">
<body>
<trans-unit id="1">
<source>Hello, world!</source>
<target>Hallo, Welt!</target>
</trans-unit>
</body>
</file>
</xliff>
Basic XLIFF 2.x Structure
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0"
version="2.0" srcLang="en" trgLang="de">
<file id="f1" original="example.txt">
<unit id="1">
<segment>
<source>Hello, world!</source>
<target>Hallo, Welt!</target>
</segment>
</unit>
</file>
</xliff>
Key Elements (XLIFF 1.2)
| Element | Description |
|---|---|
<xliff> | Root element with version |
<file> | Container for a single file |
<body> | Contains translation units |
<trans-unit> | Single translatable segment |
<source> | Original text |
<target> | Translated text |
<note> | Comments for translators |
<alt-trans> | Alternative translations |
Key Elements (XLIFF 2.x)
| Element | Description |
|---|---|
<xliff> | Root with srcLang, trgLang |
<file> | Container for file content |
<unit> | Translatable unit |
<segment> | Source-target pair |
<source> | Original content |
<target> | Translation |
<notes> | Container for notes |
<note> | Individual comment |
File Element Attributes
XLIFF 1.2
<file
source-language="en-US"
target-language="fr-FR"
datatype="html"
original="index.html"
product-name="MyApp"
product-version="2.0"
build-num="1234">
XLIFF 2.x
<file
id="f1"
original="index.html">
Language codes moved to root <xliff> element in 2.x.
Trans-Unit / Unit States
Translation States (XLIFF 1.2)
| State | Meaning |
|---|---|
new | Not yet translated |
needs-translation | Requires translation |
needs-review-translation | Translation needs review |
translated | Translation complete |
final | Approved and final |
signed-off | Officially signed off |
Example with State
<trans-unit id="1" state="needs-review-translation">
<source>Welcome</source>
<target state="needs-review-translation">Bienvenue</target>
</trans-unit>
Inline Elements
XLIFF supports rich inline markup:
XLIFF 1.2 Inline Tags
| Tag | Description | Example |
|---|---|---|
<g> | Generic group | <g id="1">bold</g> |
<x> | Generic placeholder | <x id="1"/> |
<bx> | Begin paired tag | <bx id="1"/> |
<ex> | End paired tag | <ex id="1"/> |
<bpt> | Begin paired tag (with content) | <bpt id="1"><b></bpt> |
<ept> | End paired tag (with content) | <ept id="1"></b></ept> |
<ph> | Placeholder | <ph id="1">{0}</ph> |
<it> | Isolated tag | <it id="1"><br/></it> |
Example with Inline Tags
<trans-unit id="msg1">
<source>Click <g id="1">here</g> to continue.</source>
<target>Cliquez <g id="1">ici</g> pour continuer.</target>
</trans-unit>
Metadata and Notes
Adding Notes
<trans-unit id="1">
<source>File</source>
<target>Fichier</target>
<note from="developer">Menu item label</note>
<note from="translator">Context: main menu</note>
</trans-unit>
Context Groups
<trans-unit id="1">
<source>OK</source>
<context-group name="location">
<context context-type="sourcefile">dialog.cpp</context>
<context context-type="linenumber">42</context>
</context-group>
</trans-unit>
XLIFF 2.x Modules
XLIFF 2.0+ uses modular extensions:
| Module | Purpose |
|---|---|
| Translation Candidates | Alternative translations |
| Glossary | Term definitions |
| Format Style | Formatting info |
| Metadata | Custom metadata |
| Resource Data | External resources |
| Change Tracking | Revision history |
| Size Restriction | Length constraints |
| Validation | QA rules |
Example with Glossary Module
<unit id="1">
<gls:glossEntry>
<gls:term source="computer">ordinateur</gls:term>
<gls:definition>Electronic device</gls:definition>
</gls:glossEntry>
<segment>
<source>Turn on the computer.</source>
<target>Allumez l'ordinateur.</target>
</segment>
</unit>
XLIFF vs TMX
| Aspect | XLIFF | TMX |
|---|---|---|
| Purpose | Localization workflow | TM storage/exchange |
| Content | Documents being translated | Completed translations |
| Metadata | Workflow-focused | TM-focused |
| Structure | Hierarchical (files, units) | Flat (TUs only) |
| States | Tracks translation progress | No state tracking |
| Use | Active projects | Archive/reference |
Best Practices
Creating XLIFF Files
Choose the Right Version
- XLIFF 1.2 for maximum compatibility
- XLIFF 2.x for modern workflows
Preserve Context
- Include file path information
- Add meaningful notes
- Use context groups
Segment Properly
- One translatable unit per segment
- Preserve inline formatting
- Include IDs for tracking
Processing XLIFF
Validate Structure
- Check XML well-formedness
- Validate against schema
Handle States
- Track translation progress
- Update states appropriately
Preserve Inline Elements
- Maintain tag order
- Match tag IDs correctly
Common Use Cases
Software Localization
<file original="strings.xml" datatype="xml">
<body>
<trans-unit id="btn_submit">
<source>Submit</source>
<target>Soumettre</target>
<note>Button label</note>
</trans-unit>
</body>
</file>
Document Translation
<file original="manual.docx" datatype="x-msword">
<body>
<group id="chapter1">
<trans-unit id="p1">
<source>Introduction</source>
<target>Introduction</target>
</trans-unit>
</group>
</body>
</file>
Web Content
<file original="index.html" datatype="html">
<body>
<trans-unit id="title">
<source>Welcome to Our Website</source>
<target>Bienvenue sur Notre Site Web</target>
</trans-unit>
</body>
</file>
FAQ
What is the difference between XLIFF and TMX?
XLIFF is designed for the active localization workflow — it carries documents being translated with all their metadata and context. TMX is for storing and exchanging completed translations (translation memory). You work in XLIFF, you store in TMX.
Which XLIFF version should I use?
XLIFF 1.2 offers maximum tool compatibility. XLIFF 2.x is cleaner and more modern but has less widespread support. Check your tool chain before choosing.
Can XLIFF store translation memory?
XLIFF isn't designed for TM storage, but XLIFF 2.x has a Translation Candidates module that can store alternative translations. For TM, use TMX.
How do I convert files to XLIFF?
Most CAT tools can extract content from various formats (DOCX, HTML, etc.) into XLIFF. Dedicated tools like Okapi Framework provide filters for many file types.
Is XLIFF required for localization?
No, but it's highly beneficial. XLIFF provides a standard way to share localization projects between different tools and teams, improving interoperability.
Can XLIFF handle complex formatting?
Yes, XLIFF has extensive inline element support for handling formatting, placeholders, and markup. Proper inline handling is key to preserving document structure.
