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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With