Android App Localization & Translation

Localization is one of the best ways to gain more users in the rapidly growing international Android community. Here we present a few steps you can take to get comfortably started with the localization of your app.

Internalization

Software internationalization (a.k.a i18n) is a process to separate content from code so that it can be localized. Android comes with a powerful i18n system. When you create a new Android project in Eclipse or Android Studio, it will automatically create the required files for you. A master file that contains the content that will be translated into other languages is located in the res/values/strings.xml file. In Eclipse/Android Studio you can easily add new string resource elements to this file by opening it and clicking the 'Add...' button. Then select the 'String' element and you will see two text fields that are labeled 'Name' and 'Value'. Name is the so called logical string that you use later in the code when you wish to access the string. Value is the actual string that is visible in the user interface.

TIP: When you have installed Get Localization Sync plugin for Eclipse, you can easily send this file to translation by clicking res/values/strings.xml with the right mouse button and by selecting the 'Send to translation' option. We recommend using Get Localization CLI with Android Studio (see below).

Accessing strings.xml from your Android code

Strings.xml file is the 'human readable' version of the localization file. Your app actually won't access this file directly. Instead when you compile your application, the SDK will also compile the strings.xml file to a binary format and generate a piece of Java code that will let you access the the file in the runtime. This Java class is typically named as R (as Resource). The R class contains all the resource element names you have in your strings.xml and in other resource files. This allows easy access to these resources just by using the final variable the R class provides, for example if you wish to set title for a dialog you would call it like this:

dialog.setTitle(R.string.hello_world);

Here string is a class that contains all the resource names and hello_world is one of the string resources you have added using the strings.xml editor.

Set up Get Localization Workspace for your project

Head over to sign-up page to create a new Get Localization Workspace. Choose the Workspace name carefully and remember it as you will need it later. You can either upload the master file (source file used for translation) in the UI or use additional tools we provide to sync resource files.

Android Studio and Get Localization CLI

Get Localization Sync is only available for Eclipse. However, we recommend using the Get Localization Command-Line Interface for syncing the resource files between your Workspace and local computer. Using it is pretty simple.

Install the Get Localization Command Line Tool

sudo pip install gl

Next initialize the project

cd my/project/root/
gl init [workspace-name]

workspace-name is the Workspace you created to Get Localization. Your project root is typically the same dir where you have cloned your git/hg repository.

Add your values/strings.xml to the Get Localization repository

gl add res/values/strings.xml

This is something you need to do only once. glcli is now tracking the file automatically.

Push your file(s) to Get Localization server

gl push

Now your file is ready for translation and you can proceed to your Get Localization project. Simply add the languages you wish to translate your app into and click Order translations.

Configuring translation pull

Next you need to map the translation files so that they are placed correctly in your local file system (note that you need some translations already in the system). First check status of your project.

gl status

This returns the status of your translations and also the corresponding language code. Let's assume that you have a French project and the language code is 'fr':

gl map-locale res/values/strings.xml fr res/values-fr/strings.xml

This means that the French translation of the file res/values/strings.xml is saved as res/values-fr/strings.xml. This information is saved in your local repository, you only need to do this once. Repeat this command for all your language projects.

Pull translations from server

gl pull

Summary

After setup, you simply push the translations to server with gl push command, and pull the translations back with gl pull command. It's recommended to pull the current translations before updating the new master file as processing takes some time.

Get Localization Sync for Eclipse

You have several ways to send the strings.xml to translation. For developers, we recommend using the Get Localization CLI or alternatively Get Localization Sync if you are using Eclipse. You can find step-by-step instructions how to install the Sync plug-in to Eclipse here.

Translating your file

Invite your translators to your project (with Get Localization Professional subscription), or order translations directly from our professional translators. No subscription required for professional translation and you pay only for the content you translate. You can also check our very competitive pricing.

TIP: You can change the simulator language just like in the real device in Settings.

Learn more

Android localization developer page

Information about resource files

Get Started With Get Localization Today

Get an instant translation quote Try Get Localization Workspace for Free