Note: This article describes a file format supported in Lokalise Expert, specifically in Ad hoc documents projects. This format is not available in Lokalise Vantage.
XLIFF (XML Localization Interchange File Format) is a standard XML-based format for exchanging translatable content between different tools and platforms. It is commonly used by authoring tools, content management systems (CMS), and translation tools.
In Ad hoc documents projects, Lokalise supports XLIFF versions 1.2 and 2.x. Unlike key-based localization, this project type is designed to preserve the structure, content order, and inline markup of the original file. You can upload an XLIFF file, translate its content in Lokalise, and download the translated file for use in your original authoring tool or content management system
Working with application or website strings?
See XLIFF in Web and mobile projects (.xlf, .xliff) or Apple XLIFF (.xliff) instead.
Technical information
Overview
Format name: XLIFF.
File extensions: .xliff, .xlf.
Supported versions: XLIFF 1.2 and 2.x.
Common use cases: Translating documentation, help center articles, e-learning courses, and other long-form content exported from authoring tools or content management systems.
Technical details:
Structure: XLIFF files are XML-based and contain one or more
<file>elements. Translatable content is organized into translation units containing source text and, optionally, target translations. XLIFF 1.2 uses<trans-unit>elements, whereas XLIFF 2.x organizes content into<unit>and<segment>elements.Encoding: UTF-8.
XLIFF in Ad hoc documents and Web and mobile projects
Lokalise Expert supports XLIFF files in two project types, each designed for a different localization workflow:
In Web and mobile projects, XLIFF files are treated as collections of independent translation keys. This approach is suitable for software localization, where strings can be managed independently of their original file structure and order.
In Ad hoc documents projects, XLIFF files are treated as documents. Translation keys remain associated with their original file and retain their reading order. This approach is particularly useful when translating long-form content that needs to be imported back into the system that generated the XLIFF file.
Feature | Web and mobile projects | Ad hoc documents projects |
Typical content | Application and website strings | Documentation and other long-form content |
Translation keys | Independent keys that can be renamed and modified | File-specific keys with fixed names and attributes |
Content order | Keys can be sorted independently of the original file order | The original content order is preserved |
Supported XLIFF versions | 1.2 | 1.2 and 2.x |
Existing translations | Imported by language, as described in the XLIFF in Web and mobile projects article | Imported alongside the source text for one target language, including translation states |
Downloaded file | A new XLIFF file generated from translation keys | The original XLIFF document with updated translations |
Generally, we recommend using Web and mobile projects for XLIFF files containing software strings and Ad hoc documents projects for files containing long-form content that needs to retain its original structure and formatting.
Using with Lokalise
Supported project types
This article covers XLIFF files uploaded to Ad hoc documents projects.
All .xliff and .xlf files uploaded to this project type are processed as described in this article.
Before uploading
Before uploading an XLIFF file, make sure it meets the following requirements:
Language pair: The file must contain a single source language and, if specified, a single target language. If there are multiple
<file>elements, their declared languages must be consistent.Segmentation: Translation units must not contain multiple segments. For more information, see Known limitations below.
File size: The file must not exceed 100 MB.
Encoding: The file must use UTF-8 encoding.
We also recommend ensuring that the source language declared in your XLIFF file matches the base language of your Lokalise project.
Uploading
To upload XLIFF files:
Open your Ad hoc documents project and navigate to the Upload page.
Drag and drop your files or click Select a file.
XLIFF files will appear in a separate XLIFF files table. Documents in other supported formats will appear under Other files.
Review the Detected source and Detected target columns. Lokalise automatically detects the source and target languages declared in your XLIFF files.
Select how to import the target translations:
Keep the detected target language to import existing translations into that language.
Select a different target language if necessary.
Select Skip import to import only the source text.
Adjust the remaining upload options as needed.
Click Import the files.
The source text is always imported into your project's base language, regardless of the source language declared in the uploaded file.
For more information about the available upload options, see Uploading translation files.
Language detection and warnings
If an uploaded file requires your attention, Lokalise displays a Review status alongside an explanatory message.
These warnings do not necessarily prevent the file from being imported.
Message | Explanation |
Source will be imported as language | The source language declared in the file differs from your project's base language. The source text will still be imported into the base language. Make sure you've selected the correct project. |
Language will be added to your project | The detected target language does not exist in the project. Lokalise will add it during import. |
Ask admin to add language to your project | The target language does not exist in the project, and you don't have permission to add languages. Ask a project admin to add it, or select Skip import. |
No target language detected | The file does not declare a target language. Select one manually or leave Skip import selected. |
Unsupported target code | Lokalise does not recognize the declared target language code. Select the appropriate language manually or select Skip import. |
Target matches the base language. Only the source will be imported | The selected target language matches the project's base language. Only the source text will be imported. |
Saving translations to translation memory
By default, existing translations imported from XLIFF files are not saved to your translation memory. This helps prevent draft translations, unapproved machine translations, or copies of the source text from being reused as translation memory matches.
To save finalized translations to your translation memory, enable the Save final translations to TM option under XLIFF files in the upload settings.
This option becomes available once you've added at least one XLIFF file to the Upload page.
A translation is saved to the translation memory only if all of the following conditions are met:
Its translation state in the XLIFF file is
final,signed-off, orreviewed.The source language declared in the file exactly matches the project's base language, including the regional variant where applicable. For example,
en-USandenare treated as different languages.You have reviewer rights in the project.
The translation is successfully imported into the project.
Translations that do not meet these conditions can still be imported into the project but are not saved to the translation memory.
Translations skipped during import, for example because an existing translation is not being overwritten, are not saved to the translation memory either.
Handling translation states
XLIFF files can contain information about the status of existing translations. Lokalise uses this information to assign the corresponding translation statuses during import.
This allows you to retain information about previously approved translations without having to review them again in Lokalise.
Import
Translation states are mapped as follows:
State in the XLIFF file | Status in Lokalise |
| Reviewed |
| Verified, not reviewed |
Any other state, such as | Unverified, not reviewed |
No state specified | Unverified, not reviewed |
Translations without an explicitly defined state are imported as unverified. Some tools populate target elements with copies of the source text, so the presence of target content alone does not indicate that a translation has been completed or approved.
Please note:
The Reviewed status is available only when the Reviewing feature is enabled in the project settings.
If you don't have reviewer rights in the project, imported translations can be marked as verified but not reviewed.
The
approvedandstate-qualifierattributes are not taken into account when determining translation statuses.
Export
When downloading an XLIFF file, Lokalise maps the current translation statuses back to the corresponding XLIFF states.
For XLIFF 1.2:
Status in Lokalise | State in the downloaded file |
Reviewed |
|
Verified, not reviewed |
|
Unverified |
|
No translation |
|
For XLIFF 2.x, translation states are assigned to the corresponding <segment> elements:
Status in Lokalise | State in the downloaded file |
Reviewed |
|
Verified, not reviewed |
|
Unverified | No |
No translation | No |
Working in the editor
When working with XLIFF files, you can translate and review content using the editor available in Ad hoc documents projects.
However, there are a few format-specific considerations:
Translation units. Each translation unit is imported as a single translation key. Lokalise does not perform additional sentence-level segmentation.
File structure and content order. Keys are grouped under their corresponding file headers and displayed in the same order as in the original file. This order cannot be changed.
Key names and attributes. Key names are derived from translation unit IDs. You cannot rename these keys or modify their attributes.
Inline codes. Formatting and other inline codes, such as
<g>,<x/>, and<ph>, are displayed as placeholders in the editor. When the file is downloaded, the placeholders are converted back to their original inline codes. Existing translations imported from the XLIFF file use the same placeholders as their corresponding source text.Non-translatable content. Translation units explicitly marked as non-translatable in the XLIFF file are displayed as read-only keys.
Notes. Comments stored in
<note>elements are not displayed in the editor but are retained in the XLIFF file.
Important: Make sure to preserve all required placeholders when translating XLIFF content. Removing a placeholder removes its corresponding inline code from the downloaded file, which may result in formatting issues or prevent the file from being imported back into your authoring tool.
Lokalise highlights placeholders and detects placeholder mismatches through QA checks but does not prevent you from removing them. We recommend resolving any placeholder-related QA issues before downloading your translations.
Downloading
To download your translated XLIFF files:
Open your project and navigate to the Download page.
Choose XLIFF (.xliff, .xlf) from the File format dropdown.
Select the target languages you want to export.
Under the advanced settings, configure the Empty translations option as needed.
Click Build and download.
For each selected language, Lokalise uses the original uploaded XLIFF file and updates its target translations, translation states, and target language code.
The downloaded file retains its original folder structure. The target language code is appended to the file name. For example, guide.xliff is downloaded as guide.fr_FR.xliff when exporting French (France).
If your authoring tool requires the original file name, rename the downloaded file before importing it back into that tool.
Preservation of the original file
XLIFF files are exported differently depending on their version:
XLIFF 1.2: Lokalise retains the original file structure and updates the target translations, translation states, and target language code.
XLIFF 2.x: Lokalise reconstructs the XML document from its content. As a result, XML formatting, such as indentation, may change. Lokalise also assigns IDs to
<segment>elements that do not have an explicitly defined ID.
Therefore, the downloaded XML document may not be identical to the original file at the formatting level.
Handling empty translations
The Empty translations option determines how units without translations in Lokalise are handled during export.
Individual translation units are never removed from the downloaded XLIFF document as a result of this setting.
Option | Behavior |
Export as empty strings (default) | Units without translations are exported with empty target values. |
Replace with base language | The source text is used as the target value for units without translations. |
Don't export | Units without translations retain their original content from the uploaded file. If a file contains no translations for a selected target language, the entire file is excluded from the download for that language. |
Please note that the Preview feature is not available for this format.
For more information about downloading files, see Downloading translation files.
Updating existing files
If the content changes in your authoring tool or content management system, you can export an updated XLIFF file and upload it to Lokalise using the same file name.
As with other file uploads, existing translation values are preserved unless you enable the Replace modified values option.
The behavior of the upload depends on the option selected in the Detected target column.
Updating source content
Select Skip import to update the source content and document structure.
During the upload:
New translation units are imported as new keys.
Translation keys are reordered to match the updated file.
Units that are no longer present in the file are removed from the project, together with their translations.
Existing units are matched by their IDs, allowing Lokalise to retain their associated keys and translations.
Modified source text is imported only if Replace modified values is enabled.
Important: Updating source content can permanently remove existing keys and their translations if the corresponding translation units are no longer present in the uploaded file.
If the source text of an existing unit changes, its target translations are retained. However, if Auto-mark as Unverified is enabled in the project settings, these translations are marked as unverified.
Updating target translations
Select a target language to update existing translations without changing the document structure.
During the upload:
Missing translations are imported into the selected target language.
The target language is added to the project if necessary, provided you have the required permissions.
Existing translations are overwritten only if Replace modified values is enabled and the imported text differs from the existing translation.
Changes to translation states alone are not imported.
New translation units are not added, and existing units are not removed.
Updating source content and target translations
To update both the source content and existing target translations, upload the updated XLIFF file twice:
Select Skip import to update the source content and document structure.
Upload the same file again and select the appropriate target language to import its translations.
Enable Replace modified values where necessary to overwrite existing source or target values.
Using the API
You can use the Lokalise API to automate the exchange of XLIFF files between Lokalise and your external content management or authoring tools.
Upload: Use the file upload endpoint (
/files/upload) and setlang_isoto the target language of the XLIFF file. The source text is imported into the project's base language. To import only the source text, setlang_isoto the project's base language.Translation memory: Set the
save_to_tmparameter toreviewedto save finalized translations to the translation memory. The default value isnone. The same conditions described in Saving translations to translation memory above apply.Download: Use the asynchronous file download endpoint (
/files/async-download) and set theformatparameter toxliff.
Please note that XLIFF downloads in Ad hoc documents projects are not supported by the synchronous file download endpoint.
Troubleshooting upload errors
If Lokalise cannot process an XLIFF file, the corresponding row on the Upload page displays an Error status and the message "Couldn't upload this file."
Click Learn more to view additional information about the error.
The following table describes common upload errors and how to resolve them.
Error | Explanation and recommended action |
The file has pre-segmented content | At least one translation unit contains multiple segments. Export the file again with segmentation disabled in your authoring tool. |
More than one target language in the file. | Multiple |
More than one source language in the file. | Multiple |
Target language is missing in some file elements. | Some |
Invalid target language | The target language does not exist in the project, and you don't have permission to add it. Ask a project admin to add the language or select Skip import. |
The file is not an XLIFF document. / No XLIFF version in the file. / Unsupported XLIFF version. / Unsupported file encoding. | The file is not recognized as a supported XLIFF document. Make sure the file uses XLIFF 1.2 or 2.x and UTF-8 encoding. |
No source language in the file. / Invalid source language. / Invalid target language. / No target language in the file. / Language does not match the language of the file. | A required language code is missing or invalid, or language declarations are inconsistent within the file. Check the language settings in your authoring tool and export the file again. |
Invalid XML. / Invalid XLIFF structure. / Duplicate ID. / Invalid translation state. / Invalid translation sub-state. / Unpaired formatting tag. / Invalid formatting tag. | The file contains invalid XML or XLIFF content. Where available, the error message identifies the affected line or translation unit. Correct the issue in your authoring tool and export the file again. |
Couldn't read this file. | Lokalise could not process the file. Try exporting it again. If the issue persists, contact our Support team. |
Couldn't upload this file. Try again. | An unexpected error occurred during upload. Try uploading the file again. If the issue persists, contact our Support team. |
Known limitations
When working with XLIFF files in Ad hoc documents projects, keep the following limitations in mind:
Pre-segmented content is not supported. Lokalise does not support translation units containing multiple segments. In XLIFF 1.2, this can occur when a
<trans-unit>contains multiple<mrk mtype="seg">elements. In XLIFF 2.x, this occurs when a<unit>contains multiple<segment>elements. Units containing a single segment are supported.One language pair per file. Each XLIFF file can contain one source language and one target language. To import translations for multiple target languages, upload a separate file for each language.
Inline codes are not fully protected. Removing a placeholder from a translation removes its corresponding inline code from the downloaded file. Resolve placeholder-related QA issues before exporting.
Language codes are taken from the project. When downloading translations, Lokalise uses the target language code configured in the project rather than retaining the exact code from the original file. For example,
fr-frmay becomefr-FR.Notes are not displayed in the editor. Content stored in
<note>elements is preserved in the XLIFF file but is not available as translation context in the editor.Unmatched inline codes in imported translations are removed. If an imported target translation contains an inline code that has no corresponding code in the source text of the same unit, that code is removed.
File preview is not available. You cannot preview XLIFF files on the Download page.
Asynchronous API downloads only. The synchronous API download endpoint does not support XLIFF files in Ad hoc documents projects.




