Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android : How can i make my application multilingual? [duplicate]

Possible Duplicate:
How can I create a multilingual android application?

I am creating application and i am in the testing phase, but i want to make my application multilingual.

How can i make it multilingual ? What is the best way to make it ?

like image 685
Basbous Avatar asked Jan 16 '12 16:01

Basbous


People also ask

How do you make an app with multiple languages?

Multilanguage support is easy done for android. Create a new values directory for the language with the suffix of the language code. For german: values-de or french: values-fr than copy your string. xml into that and translate each entry.

What is RTL support in Android?

Android 4.1 (Jelly Bean) introduced limited support for bidirectional text in TextView and EditText elements, allowing apps to display and edit text in both left-to-right (LTR) and right-to-left (RTL) scripts.


2 Answers

The thing that you need to do is to create new folders in your res folder.

Example : If you need to add support to spanish and italian you need to do it like this :

  1. res folder

    1.1 values

    1.2 values-es // spanish

    1.3 values-it // italian

And after that you need to create string.xml files in values-es and values-it. And in all files you just need to create all string which you want to use like this :

<string name="title">Title</string>  // in values folder
<string name="title">Title in Spanish</string>  // in values-es folder
and etc.

And after that you can use these string as :

TextView text = (TextView) findViewById(R.id.textView);
text.setText(getString(R.string.title));

And this should work.

like image 147
Android-Droid Avatar answered Nov 03 '22 22:11

Android-Droid


Take a look at this tutorial about localizing applications: http://developer.android.com/resources/tutorials/localization/index.html.

Maybe it helps.

like image 26
eboix Avatar answered Nov 03 '22 22:11

eboix