Header Content

Android Multi-Language support

Recently I’ve been adding the ability to code an app so it can be understood in different languages..

Let’s say for instance that we want to do a Hello World! app and be able to say hello in different languages.

First, you need to decide what languages you need to support (these may vary depending on the devices).

Then you create “values” folders for each of those languages within the res folder in your project.

To get an idea for what the folder suffix should be, check the Custom Locale app on your device.. for English, there are several options to choose from, and you can support each one with a different folder naming convention – en-GB for Great Britain English for instance, or en-US for United States English.  Be sure you change the underscore (if there is one) to a dash as the underscore won’t be recognized and your app won’t interpret properly.

Now within each values folder there should be a strings.xml file.  There is no special naming convention needed on the strings.xml file name itself.

all strings.xml should have something like the following specified at the top:

<?xml version=”1.0″ encoding=”utf-8″?>


For our english value version for “Hello World!” we would put the following line:

<string name=”hello_world”>Hello World!</string>

For our spanish value version – it would be something like this:

<string name=”hello_world”>¡Hola Mundo!</string>

and close your strings.xml file with


Note that the string name is the same for both languages “hello_world”.  this is the value that we will reference later on in the code.

Now within your layout xml, or in a src java file,  you can reference the string by @string/hello_world or getResources().getString(R.string.hello_world).

At runtime your app will know based on your device Locale which language to choose from.

Comments are closed.

Footer Content