Internationalizing an app for Android and iOS is one the tasks most programmers do not have any experience with as it supposed to really belong to the realm of the translation company. When you have finished your programming work (and oftentimes during development, see our blog article about “Agile Localization“), you will need Android and iOS translation into other languages.
At this point, you will be faced with the decision of translating the UI (user interface strings) in the Android and iOS apps independently or together. Clearly, translating each app independently is the recommended and easier option as far as workflow and development effort is concerned. However, you may think that quite likely the since the same strings of text will be used both in the Android version and the iOS version of your app, you do not want to pay twice for the same sentence. Or you may have other reasons to include all the text in a single translation file. We will deal with how to join both Android and iOS files for translation in a separate article. For now, let’s concentrate on the easy steps to gather and export the text for localization for Android and iOS translation.
If you are not familiar with the translation process, it is important to know a few basics: any reputable translation company will use translation memories (a desktop or server database where translated sentences are saved in aligned format, one being the equivalent of the other). Therefore, translation savings should be passed on to you as a result of the translation house checking it has translated similar sentences for you in the past, even across platforms (text strings in Android and iOS, website, documentation, etc.).
Once you provide a text file in XML, XLIFF, CSV or Excel format, you should receive a translation analysis looking similar to this.
As you can see, a translation log contains a percentage analysis, providing you the chance to see how much money you can save as a result of similar material having been translated in the past or repetitions (this is particularly relevant when new versions or similar apps are developed).
Before we go any deeper, we would like to note at this point you should already be familiar with some concepts on string internationalization on Android and iOS. If not, we recommend that you start by reading Internationalization and Localization Guide (iOS) and Supporting Different Languages (Android). We understand there are quite likely other resources except strings and text (embedded in illustrations, for example) that need to be considered when localizing an application, but this article will focus only on strings as it is the most common problem.
You can export all the content in strings from code and interface builder files in a single step by exporting to XLIFF using Apple’s Base Internationalization (available from Xcode5 onwards). This export/import feature extracts the localizable strings to an external XLIFF file for the translation house to work on. This file will not be directly used by your app. It is an international format to exchange bilingual information. It is used particularly for translations and also for importing and merging translated text strings from XLIFF files into strings files. Base internationalization will collect texts from
.xib files automatically. You can also choose to include images, for example, as well as other resources that you may want to translate.
Xcode will move or duplicate all of these resources into a Base.lproj folder in your project. It will also create a separate folder for each target language you need to translate into and store the localized version of these resources.
Apple provides a short guide on how to export XLIFF files and import them in order to localize your app, see the link below
There several ways you can export text for translation in Android, and even export to Excel if this makes it visually easier for your to work.
To do this:
strings-> right click->
Open Translations Editor. Then copy and paste the data required from
- You can then import the resulting Excel-based translations back into the Translation Editor.
However, your main aim to translate an Android app should be to export all the content in strings from code and interface builder files in a single step by exporting to XML. The translation house will convert XML files to XLIFF format in order to have a bilingual file. Perhaps one of the easier tools for android app string localization is the Translations Editor (inbuilt into Android Studio).
If you or the translation company use Translation Editor, the process becomes easier for translators (since they or you can then export to XML and run their own checking tools, terminology and translation memories within their own translation tools). Allowing translators to use computer assisted translation tools (CAT tools) makes the whole process less prone to errors. The XML string files in Android Studio support XLIFF notations that are a standardized method to aid string localization.
By utilizing XLIFF notation in your XML string files you can do the following to help the translators:
- Provide additional context for declared strings
- Mark message parts that should not be translated
To use XLIFF in your Android string XML files you need to include the XLIFF 1.2 namespace:
<resources style="font-weight: inherit;font-style: inherit;color: #303336">="urn:oasis:names:tc:xliff:document:1.2">
To access the Translations Editor in Android Studio, select Open Translations Editor from the context menu for your XML string file (ie. strings.xml) in your project tree. Your translation service (or yourself) should be able to export from here. Translators will prefer to work in their own tools as Translation Editor does not let you customize the font it uses. Another pitfall of the Editor as a translation environment is that one cannot simply type the translation one after the other, you have to double-click each and every item to get a cursor. Therefore, our recommendation is that you export the text and import it back in.