3

I want to create a multi-language Android application with three languages: English, Arabic and Persian language.

I must create three XML files in the assets folder and parse them all, then use one for the language?

Please help me to resolve my problem?

Dan
  • 59,490
  • 13
  • 101
  • 110

2 Answers2

6

You need to have different strings.xml to support different langauges.

http://developer.android.com/training/basics/supporting-devices/languages.html

What is the list of supported languages/locales on Android?.

I don't think there is support for persian language.

Example:

MyProject/

res/
   values/
       strings.xml

   values-es/
       strings.xml

   values-fr/
       strings.xml

   values-ar/          // for arabic
       strings.xml     

For spanish

 <?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="title">Mi Aplicación</string>
    <string name="hello_world">Hola Mundo!</string>
</resources>

At runtime, the Android system uses the appropriate set of string resources based on the locale currently set for the user's device.

http://developer.android.com/guide/topics/resources/localization.html

TextView textView = new TextView(this);
textView.setText(R.string.hello_world);

Check the doc for more info

http://developer.android.com/training/basics/supporting-devices/languages.html

Community
  • 1
  • 1
Raghunandan
  • 132,755
  • 26
  • 225
  • 256
0

Yes u need to create three type of xml.

res/
   values/
       strings.xml
   values-es/
       strings.xml
   values-fr/
       strings.xml

Refer this doc.

EDIT

Please Check this Example.So u can get idea On Multi language supporting.

Bhoomika Brahmbhatt
  • 7,404
  • 3
  • 29
  • 44