XLIFF (XML Localisation Interchange File Format) is an XML-based format created to standardize how localizable data is passed between tools during a localization process.

XLIFF is also used more often in software translation than traditional translation tools.
Several tools, such as Xcode or the Multilingual app toolkit, allow you to export and import XLIFF files as an alternative to the more proprietary resource file formats.

Format

  • Lingohub is capable of handling files based on XLIFF 1.2.
  • An XLIFF file holds source and target language information in one file.
  • The <target> attribute can be omitted, but we always need a <source> attribute.
  • The <file> element must specify the attributes source-language and target-language.
  • The segment key is specified by the <trans-unit> id attribute (resname attribute as an alternative)
  • The <trans-unit>s can be grouped using <group>, and the id value of the group will prefix the segment key. So a id only needs to be unique in its group.
  • The <note> attribute inside <trans-unit> will be stored as a description for your translators.
  • All attributes on your elements will be stored by Lingohub and exported as imported.
  • <context-group> information will be stored by Lingohub and exported as imported.
  • <header> information will be stored by Lingohub and exported as imported.
  • Placeholders can be defined using the <ph> element. Eg. <ph id="1">{0,number}</ph>

Examples

Additional example files can be accessed here.

<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" 
  xmlns="urn:oasis:names:tc:xliff:document:1.2" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-strict.xsd">
<file original="sample.properties" 
  source-language="en" target-language="de" 
  datatype="javapropertyresourcebundle">
<body>
   <trans-unit id="1" resname="key1">
      <source xml:lang="en">Box 12 is <ph id="1">{0,number}</ph> inches high.</source>
      <target xml:lang="de">Box Zwölf ist <ph id="1">{0,number}</ph> Zoll hoch.</target>
   </trans-unit>
   <trans-unit id="2" resname="key2">
      <source xml:lang="en">Box &quot;<ph id="1">{0}</ph>&quot; is blue.</source>
      <target xml:lang="de">Box <ph id="1">{0,number}</ph> ist blau.</target>
   </trans-unit>
   <trans-unit id="3" resname="key3">
      <source xml:lang="en">Boxes are built in three sizes: small, medium and large.</source>
      <target xml:lang="de">Boxen werden in drei Größen gebaut: klein, mittel und groß.</target>
   </trans-unit>
    <group id="messages:2">
      <trans-unit id="4" resname="key4" xml:space="preserve">
          <source>Hello <ph id="1">username</ph></source>
          <context-group name="sample properties" purpose="location">
            <context context-type="sourcefile">XliffInfo.java</context>
            <context context-type="linenumber">34</context>
          </context-group>
      </trans-unit>
    </group>  
</body>
</file>
</xliff>

References