Localizing XLIFF files for iOS

Firefox for iOS uses the XLIFF XML-based file format to hold and transfer localization data. XLIFF (eXtensible Localisation Interchange File Format) is a localization standard governed by the OASIS standards body. The goal of the standard is to have an XML-based format to use when exchanging localization data between tools without the potential of data loss or corruption. Most translation tools support the XLIFF standard, making localizing the XLIFF files for Firefox for iOS easy to do using translation tools. Editing the raw XLIFF file is also rather easy, especially if you're already familiar with XML. This tutorial will walk you through the steps you need to take to translation strings within an XLIFF file.

String repository for Firefox on iOS

The firefox-ios.xliff file is located in SVN.

  1. Decide where on your local computer you will store your copy of the github repo and navigate there in your terminal.
  2. Enter the command git clone https://github.com/mozilla-l10n/firefoxios-l10n/your-locale-code/
  3. You should now see the firefox-ios project in your selected directoy with the firefox-ios.xliff file in it.

Translating the XLIFF file

  1. Open the firefox-ios.xliff file in your favorite text editor.
  2. In the <file> tag, add the target-language attribute with your locale code as the value (e.g., target-language="xx-XX"). Be aware that there may be many <file> tags within one XLIFF document. Each <file> tag requires the target-language attribute with your locale code as the value (e.g., target-language="xx-XX").
  3. Strings are located within <trans-unit> tags. Source English strings are contained in <source> child tags. Here is an example of such a <trans-unit>
    <trans-unit id="Add to Bookmarks">
        <source>Add to Bookmarks</source>
    </trans-unit>
    
    Your translations must be contained inside <target> child tags. Go through the full xliff page adding <target></target> below each <source> tag set to help you to identify strings that need to be translated. Do not delete the <source> tag sets.
    <trans-unit id="Add to Bookmarks">
        <source>Add to Bookmarks</source>
        <target>YOUR_TRANSLATION_HERE</target>
    </trans-unit>
    
  4. Provide translations of the strings in the <source> tag sets by placing their translations in the <target> tag sets beneath them. Keep in mind the following sets of characters that need to remain untranslated:
    1. $(SOME_TEXT_HERE) is a variable format,
    2. %1$@ is another variable format.
    3. <note> tags contain localizer notes from developers and should not be translated.
    <trans-unit id="Add to Bookmarks">
        <source>Add to Bookmarks</source>
        <target>Agregar a marcadores</target>
        <note>No comment provided by engineer.</note>
    </trans-unit>
    
  5. Save your translations along the way.
  6. Once you've completed translation, it's important to make sure the XML in your XLIFF file is valid (e.g., no broken tag sets). Open the file in Firefox to have it run a validity check and correct any errors it might yell about.

Commiting your XLIFF file

  1. Using this command, commit your translated XLIFF file into your locale's directory: git commit -m "Commit message here" .
  2. Push your commit into the github repo: git push
  3. Kick up your feet, pop open a cold beer (or soda), and pat yourself on the back for doing something new, different, and exciting!

Document Tags and Contributors

 Contributors to this page: jbeatty, Flod
 Last updated by: jbeatty,