Apple XLIFF files (.xliff) are generated by Xcode for managing localization in iOS and macOS applications. These files aggregate translations for all .strings and .stringsdict files, as well as localizable resources such as .storyboard, .xib, and Info.plist files.
Technical information
Overview
Format name:
Apple XLIFF
File extensions:
.xliff
Common use cases:
Aggregating translations for various localizable resources in iOS and macOS applications.
Technical details:
Structure: Apple XLIFF is based on the standard 1.2 XLIFF specifications. It supports plural translations (starting with Xcode 9) and variable width translations (starting with Xcode 10).
Encoding: UTF-8
Example:
Here's an example of a typical Apple XLIFF file:
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2">
<file original="Main.storyboard" source-language="en" target-language="fr">
<body>
<trans-unit id="welcome">
<source>Welcome</source>
<target>Bienvenue</target>
</trans-unit>
</body>
</file>
</xliff>
In this example, the XLIFF file includes a single translation unit for a string from a storyboard, translating "Welcome" from English to French.
Using with Lokalise
Lokalise supports Apple XLIFF files, allowing you to manage your translations within the Lokalise platform.
However, due to certain limitations with Xcode's handling of XLIFF files, for iOS projects, it is often recommended to use .strings
and .stringsdict
files directly. While XLIFF files offer benefits like generating keys for new elements in .storyboard files, they come with drawbacks that limit their effectiveness in a translation management platform.
Supported project types
Please note that Apple XLIFF files can be uploaded only to Web and mobile projects.
Special notes and limitations
Plural translations: Supported by Lokalise.
Variable width translations: Not supported by Lokalise.
Base language value matching: When importing an XLIFF to Xcode, every key must have the same base (source) language value in the Xcode project and in the XLIFF document. If there is a mismatch, updates to these keys are ignored. This means it's not possible to use Lokalise to update base (source) language values.
Non-base language translations: Translations for non-base (non-source) languages will be ignored if the value for the base (source) language was also changed.
Additional reading
How to open and translate XLIFF files in Lokalise online editor β this tutorial covers XLIFF files and how to work with them on Lokalise.
XLIFF files β documentation on regular XLIFF files used in Lokalise
Xcode localization catalog β documentation on generating, importing, and exporting XLIFF.