XLIFF 2.0

Last updated: February 06, 2026Author: Jakub Pomykała
xliff:2
File format value
xliff:2

XLIFF 2.0 is a standard XML-based format for exchanging localization data between tools. Compared to XLIFF 1.2, version 2.0 uses a slightly different structure (translation units are represented by <unit> and <segment> elements).

Format structure

The XLIFF 2 format consists of a root <xliff> element, which contains one or more <file> elements. Each <file> element groups translation units (<unit>), and each unit contains one or more segments (<segment>).

<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en" trgLang="fr">
  <file id="app_strings" original="messages.json">
    <unit id="welcome_message">
      <segment>
        <source>Welcome to our application!</source>
        <target>Bienvenue dans notre application !</target>
      </segment>
      <note>Displayed on the login page</note>
    </unit>

    <unit id="greeting">
      <segment>
        <source>Hello, <ph id="1" equiv="username"/>!</source>
        <target>Bonjour, <ph id="1" equiv="username"/>!</target>
      </segment>
    </unit>
  </file>
</xliff>

Attributes

  • srcLang: Source language code.
  • trgLang: Target language code.
  • file@id: File identifier.
  • file@original: Original filename (optional).
  • unit@id: Translation key.

translate="no"

In XLIFF 2, the translate attribute can be defined on unit and/or segment. SimpleLocalize supports translate="no" (and common non-standard variants like false/0). When present, the imported key will be marked as non-translatable (equivalent to disabling auto-translation).

Comments

You can add comments/description using the <note> element. In SimpleLocalize, <note> is imported as a key description and exported back as <note>.

Placeholders and inline markup

XLIFF 2.0 supports inline elements such as:

  • <ph /> for placeholders
  • <mrk> for marked spans (e.g. plural forms)

SimpleLocalize preserves inline markup during import and export.

Namespaces (Original as namespace)

When importing XLIFF 2 files, SimpleLocalize can automatically detect namespaces.

  • If ORIGINAL_AS_NAMESPACE is enabled, SimpleLocalize uses file@original as namespace.
  • If file@original is missing, it falls back to file@id.

Custom attributes

SimpleLocalize can store XLIFF 2.0 file metadata in customAttributes on each KeyTranslationWord so it can be reused during export.

Supported keys:

  • xliff2:file:id - exported as <file id="...">
  • xliff2:file:original - exported as <file original="...">

This is useful when you want to keep original file information even if your export namespaces differ.

Limitations

  • SimpleLocalize reads translations from the first <segment> in each <unit>.
  • If <target> exists but is empty, an empty translation is imported (no fallback to <source>).

Upload source translations

To upload source translations to SimpleLocalize, use the upload command with --uploadFormat xliff:2.

simplelocalize upload \
  --apiKey PROJECT_API_KEY \
  --uploadLanguageKey en \
  --uploadFormat xliff:2 \
  --uploadPath ./en.xliff

Learn more about upload command.

Export translations

To export translations from SimpleLocalize, use the download command with --downloadFormat xliff:2.

simplelocalize download \
  --apiKey PROJECT_API_KEY \
  --downloadFormat xliff:2 \
  --downloadLanguageKeys fr,de \
  --downloadPath ./{lang}.xliff

--downloadLanguageKeys is optional. If you omit it, all translations will be downloaded.