In this article, we take a look at the pros and cons of one of the most popular formats for storing and handling localized strings to help you decide if it’s a good fit for you.
XLIFF - Standard File Format for Translations
What does XLIFF look like?
Integrating XLIFF into your code
XLIFF localization process
“What if we are Agile developers?”
“Long story short
When you’re just starting to develop your app, localization might not seem like something you have to think about much. But this comes at a cost later: As you grow and eventually decide to translate your software to other languages, you might find yourself with a plethora of strings that you have no idea how to deal with in other languages.
As a result, you have to invest extra time thinking about what to do, you cannot make quick changes to the localized versions of your app, and end up with low-quality translations because you haven’t provided the translators with the right context to get the job done.
To avoid these pains in the future, it’s important to think about localization, or at least internationalization, in the very first phases of development. And the main question is: What localization format should you choose?
Below, we take a look at XLIFF, one of the most sophisticated formats for software localization. Unlike JSON and YAML, it is not well-known among software engineers and developers. So, should you still consider using it? Let’s find out.
What does XLIFF look like?An OASIS standard, XLIFF — XML Localization Interchange File Format — is the de-facto language industry standard for exchanging localized strings between applications. As such, it has the highest level of support in most translation tools and has the most comprehensive solutions for the most common localization issues. Companies such as Apple and Microsoft choose XLIFF as the basis for their internationalization frameworks.
As the name suggests, XLIFF is an XML-based format, meaning that any parser that works with XML will work with XLIFF as well. This makes it easier to use for both translation platforms and for localization libraries.
Here’s what a typical XLIFF looks like:
The main parts of an XLIFF file are and elements, with the former containing the smallest indivisible “atoms” of text — say, sentences, — and the latter grouping them into bigger, “molecular” elements — say, paragraphs.
Each contains the