Success with mobile apps is often a numbers game — the more users, the more successful an app will be. Some of the ways to increase users, such as localizing to other languages, require advance planning. If an app has been prepared for localization, then translating it to several new languages can be an easy way to make the app accessible to a huge number of new customers.
Understand how localization works for Android
Android supports a fairly sophisticated resource system to help handle myriad configurations of Android devices — not just sizes and resolutions, but languages and a number of other factors. Much of this is automatic, but you need to prepare your app to take advantage of this system.
The Android Developers documentation on localization spells out the details, or you may want to learn the basics of supporting multiple languages first. There’s a goldmine of useful information there, so read up after you finish this article.
Make good use of resource files
First thing is first though: You can’t localize text that is explicit in your code — you need to pull your text strings out and place them in a resource file (e.g., strings.xml) where they can be managed separately. For example, this text cannot be localized:
TextView textView = new TextView(this);
textView.setText("This text is always in English");
This text can be localized:
TextView textView = new TextView(this);
textView.setText(R.string.localized_text);
This text is to just obtain the string in the current language:
String localized = getResources().getString(R.string.localized_text);
The resource file, placed in the correct location in the file structure, will supply the string when the system requests it. For example, your strings file for English (/values-en/strings.xml) might contain:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="localized_text">This text will be correct</string>
</resources>
Similarly, your strings file for Spanish (/values-es/strings.xml) might contain:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="localized_text">Este texto será correcto</string>
</resources>
When the app goes to load the resources, it will pull the correct value for whatever locale has been selected for that Android device.
Warning: There should always be a default set of resources (e.g., /values/strings.xml). If the system is in an untested locale and can’t find a requested resource, it will crash. For that reason, many developers put the English resources in /values rather than /values-en.
Manage your translations
Once all of your strings are pulled out into an XML file, they can be sent to a translator, after which point the translated file quickly makes your app able to support the new language.
You might be wondering how to make sure that you didn’t miss any strings, particularly if the app has been updated and new strings have been added. A number of tools have tackled that problem. One of these tools is the MOTODEV App Validator, which can be used as part of the MOTODEV Studio, as an Eclipse plug-in, or as a simple drag-and-drop web interface. This tool reports missing translations and a number of other common problems that are easy to detect.
Earlier this year, the Android team updated the Lint Tool to also check for missing translations. This is great, because every Android developer with the standard Eclipse programming environment with the Android Developer Toolkit (ADT) can easily do these checks by right-clicking the project, going to Android Tools, and clicking Run Lint: Check For Common Errors (Figure A).
Figure A
I’m a strong believer in these automated tools — they can save you many hours of work down the road. You should fix the easy bugs now before anyone sees them.
Let users know your app is translated
If nobody knows that your app is translated, it won’t help drive many downloads (but it might be a welcome surprise to some users). Now that you’ve done all the work, let people know.
First, translate the app description to all languages to which you have localized. This lets users browsing their app store see the descriptions in their native language. Google employees have suggested doing this even if your app isn’t translated, because many people are willing to use an app in another language, but they might be more comfortable browsing entirely in their native language. Many other Android app stores also support multiple languages for the listings.
Next, your app description can list the languages that your app is available in — this can be important because the translated description doesn’t guarantee that the app is translated. If you state the supported languages, it might give users a little more confidence to download your app.
Support new users
There are various opinions about supporting your users in different languages. Some developers say their users are happy to ask questions in another language but receive answers in English. Others say that you need to provide full support in each language that your app supports.
The nature of your app as well as the budget for supporting these users will likely determine the best course of action for you. Either way, you can likely make good use of Google Translate for a rough translation of the incoming message, and decide what to do from there.
Going further
The first time you localize your app, you might find there are still a number of strings that are hard-coded and need to be pulled out. The automated tools can help with that too, but check the Lint warnings! Hopefully you’ll take to putting new strings into a resources file when you add them, and eventually it should be a routine matter to translate the strings file and drop in the new translation.
Once you master the basics, start considering other localization issues such as currencies, units of measurement, and colors. Top-tier Android developers take these things into consideration, and their apps stand ahead of the rest.