Xliff

Xliff is a xml based format for app localization

For automating the translation process of your application, the XLIFF (XML Localization Interchange File Format) can be a highly effective solution. It can be used for a wide range of software localization projects. XLIFF provides a standardized format to manage and transport text strings and their translations between tools and platforms. It supports text strings with optional styling and formatting. You can create and edit base strings in your preferred development environment. Once translated, these strings are easy to reference and integrate into your application's user interface, facilitating a streamlined and efficient localization workflow. It also works via the Applanga's CLI integration.

Example:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
  <file source-language="en" datatype="plaintext" target-language="de" date="2023-12-19T09:31:12Z" product-name="haha" tool="Applanga">
    <header>
      <tool tool-name="Applanga"/>
    </header>
    <body>
      <trans-unit id="Example Key" maxwidth="13" size-unit="char" x-length-option="equals-source">
        <source>example value</source>
        <target>example ger value</target>
        <context-group purpose="information">
          <context context-type="x-applanga-source-context-url">Context Url</context>
        </context-group>
        <state>needs-review-translation</state>
        <note from="description">example description</note>
        <note from="Example Metadata Field">Example Metadata Value</note>
      </trans-unit>
    </body>
  </file>
</xliff>

Applanga XLIFF Format Documentation

'file' Element

  • parameters:
    • source-language: Corresponds to the source language of your project. This attribute is crucial for ensuring language consistency.
    • datatype: Always set to "plaintext". This parameter defines the nature of the data contained in the file.
    • target-language: Indicates the intended target language for the file. It's important to note that if there's a discrepancy between the file's import language and this attribute, Applanga will flag an error.
      • Example: If the file is imported under "ar" (Arabic) but target-language is set to "de" (German), an error will occur.
    • product-name: Reflects the project's name during export. This attribute is not considered during import.
    • tool: Identifies "Applanga" as the tool used for export. This attribute is disregarded during import.
    • original: Set's the source value for all key's defined inside to this value
      • Example original="en.xliff"

'trans-unit'

  • parameters:
    • id: Denotes the name of the described key in the trans-unit element.
    • x-length-option: Specifies restrictions related to the length of the target language text. Possible values include:
      • "equals-source": The target text length must match the source text length.
      • "disabled": No length restriction is imposed.
      • "manual": A specific length restriction, as defined in the maxwidth attribute.
    • "maxwidth": This attribute is applicable only when x-length-option is set to 'manual'. It specifies the maximum number of characters permitted for the target text.
    • "size-unit": Mandetory when using 'manual' length option. This is always set to 'char' (character).
    • "translate": Indicates whether a translation unit is locked (non-editable). If locked, its value is "no".

Source Element => Source Value

  • Contains the original text that needs to be translated.

Target Element => Translation value

  • Holds the translated text corresponding to the source.

Context-Group Element => Screenshot Context Url's

  • parameters:
    • purpose="information": This attribute is always set when a context group is included, providing additional information about the translation unit.

Context Element

  • parameters:
    • context-type="x-applanga-source-context-url": This attribute is always present when context information is included.
  • The text value is a URL pointing to contextUrl with Screenshots for the source text.

State Element => Statuses

  • Displays the current status of the Key. Default status texts are:
    • 'signed-off' for Accepted
    • 'needs-review-translation' for Needs Review
    • 'needs-translation' for Needs Translation
    • 'x-rejected' for Rejected
  • Custom status texts start with 'x-' followed by the XML-escaped custom status name.
    • Examples:
      • "MyCustomStatus" becomes 'x-MyCustomStatus'.
      • "My<XmlCustom>Status" becomes 'x-My<XmlCustom>Status'.

'Alt-Trans' Element => Draft Value

  • parameters:
    • 'alttranstype' = 'proposal': This attribute is consistently present when the alt-trans element is used.
  • Contains the draft translation.

'Note' Element => Descritions/Comments/Metadata

  • parameters:
    • "from" = 'description': Contains a description of the translation key.
    • "from" = 'comment': Contains a comment relevant to the translation key.
    • from might also correspond to an XML-escaped name of a metadata attribute in Applanga. Then it will contain the Metadata attribute.

'Reference' Element => Screenshot urls

  • Includes links to external resources, typically presigned URLs pointing to relevant screenshots.

'External-File' Element

  • parameters:
    • id: Corresponds to the unique identifier of the associated screenshot or reference material.
    • href: The presigned URL of the screenshot, valid for a limited time (usually 15 minutes).

XSD

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">

    <!-- Redefining the xliff namespace -->
    <xs:import namespace="urn:oasis:names:tc:xliff:document:1.2"/>

    <!-- Root Element -->
    <xs:element name="xliff" type="xliff:xliffType"/>

    <!-- XLIFF Type -->
    <xs:complexType name="xliffType">
        <xs:sequence>
            <xs:element name="file" type="xliff:fileType" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="version" type="xs:string" use="required"/>
    </xs:complexType>

    <!-- File Type -->
    <xs:complexType name="fileType">
        <xs:sequence>
            <xs:element name="header" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="tool" minOccurs="0" maxOccurs="1">
                            <xs:complexType>
                                <xs:attribute name="tool-name" type="xs:string" use="optional"/>
                            </xs:complexType>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="body">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="trans-unit" type="xliff:transUnitType" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="source-language" type="xs:string" use="required"/>
        <xs:attribute name="datatype" type="xs:string" use="required"/>
        <xs:attribute name="target-language" type="xs:string" use="required"/>
        <xs:attribute name="product-name" type="xs:string" use="optional"/>
        <xs:attribute name="tool" type="xs:string" use="optional"/>
        <xs:attribute name="date" type="xs:dateTime" use="optional"/>
    </xs:complexType>

    <!-- Trans-Unit Type -->
    <xs:complexType name="transUnitType">
        <xs:sequence>
            <xs:element name="source" type="xs:string"/>
            <xs:element name="target" type="xs:string"/>
            <xs:element name="context-group" type="xs:string" minOccurs="0"/>
            <xs:element name="context" type="xs:string" minOccurs="0"/>
            <xs:element name="state" type="xs:string" minOccurs="0"/>
            <xs:element name="alt-trans" type="xs:string" minOccurs="0"/>
            <xs:element name="note" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:simpleContent>
                        <xs:extension base="xs:string">
                            <xs:attribute name="from" type="xs:string" use="required"/>
                        </xs:extension>
                    </xs:simpleContent>
                </xs:complexType>
            </xs:element>
            <xs:element name="reference" type="xs:string" minOccurs="0"/>
            <xs:element name="external-file" minOccurs="0">
                <xs:complexType>
                    <xs:attribute name="id" type="xs:string" use="required"/>
                    <xs:attribute name="href" type="xs:anyURI" use="required"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="id" type="xs:string" use="required"/>
        <xs:attribute name="x-length-option" type="xs:string" use="optional"/>
    </xs:complexType>
</xs:schema>

Website: XLIFF File Format

File Extension
.xliff
CLI format key
xliff
CLI Supported
true
SDK Supported
false
String Description Supported
true
Pluralization Supported
false