How to Translate Applications Using the Google Android Development Environment

How to Translate Applications Using the Google Android Development Environment
Page content

Imagine you have developed a great application and you want to sell it (or just put it, so people can download it and test it) in the Android Market. Maybe your potential clients are English-readers…or not! You simple don’t want to loose the chance of expanding your application all over the world.

The languages we can work with are limited to the Android software, If you take your device and go to Settings and then to Locale & text you can change the language of your phone. In latest software version (latest is 1.5) you can choose between the following languages:

  • German (From different countries)
  • English (From different countries)
  • Spanish
  • French
  • Italian
  • Dutch

So we are limited to these languages for now. In future releases let’s hope this list will increase.

When we change a language, every application text (and images, if they are well designed), change to the new language.

This is going to be VERY useful to us. Let’s talk a bit more about the resources.

Resources & Languages

In the /res folder in the project, we have stored all the resources files we need in our application. It is up to us to use them properly. In our case, lets have a look to the most important files/folder to our purpose.

/res/values

In this folder we can find the “string.xml” file. We can…well, we MUST use this file to store all the strings we are using in the application.

/res/drawable

Here, we store the images of the application, Its preferable to store them in PNG format.

Well, once we have introduced this files / folders…but…what relationship have this with the languages? Lets see.

If we use the ISO 639-1 Code (Code for language representation) in the resources folders like this:

values-es

drawable-es

for Spanish or

values-fr

drawable-fr

for French

and you store in them the strings and the images in the proper language, every time you change the mobile language, it will change in your application too. This easy.

Want more?

Every time you create an application, you should take language use into account. After all who knows whos going to use your application… So keep this in mind from the beginning!!

This post is part of the series: How-to develop Google Android Applications - Going further

Here more functionality and simple how-to guides to show you how to work with Google Android

  1. Dev Guide to Translating Apps in Android
  2. Guide to Intents in Android Development
  3. Guide to Intents for Android Developers. Part II
  4. How to Program the Google Android Camera to Take Pictures
  5. Android UI Java Programming Tutorial