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.
- Decide where on your local computer you will store your copy of the github repo and navigate there in your terminal.
- Enter the command
git clone
https://github.com/mozilla-l10n/firefoxios-l10n/your-locale-code/
- You should now see the firefox-ios project in your selected directoy with the
firefox-ios.xliff
file in it.
Translating the XLIFF file
- Open the firefox-ios.xliff file in your favorite text editor.
- In the
<file>
tag, add thetarget-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 thetarget-language
attribute with your locale code as the value (e.g.,target-language="xx-XX"
). - 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>
- 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:$(SOME_TEXT_HERE)
is a variable format,%1$@
is another variable format.- <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>
- Save your translations along the way.
- 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
- Using this command, commit your translated XLIFF file into your locale's directory:
git commit -m "Commit message here"
. - Push your commit into the github repo:
git push
- Kick up your feet, pop open a cold beer (or soda), and pat yourself on the back for doing something new, different, and exciting!