Jason Ching
Jason Ching

Reputation: 1057

How to internationalize Android app?

How do I determine the language setting of an Android device. I am doing this to internationalize my app. Thanks!

Upvotes: 3

Views: 8292

Answers (6)

khaoula1305
khaoula1305

Reputation: 74

There is a very simple method: right click on the strings.xml file and select Open translation editor or click on open editor. enter image description here You will see the different entries appear in the strings.xml file. By clicking on the icon representing the Earth (Add local), you can add a new language and enter the translation of the entries as desired.

enter image description here enter image description here When this is done, you should see a new strings.xml file appear in the tree window, accompanied by the flag of the chosen language and the extension of this language in parentheses. You just have to compile and test the application on your emulator, by testing different language choices on it.

Upvotes: 3

Rahul Sondarva
Rahul Sondarva

Reputation: 11

You have to use different string.xml files

res/ values/ strings.xml values-hi/ strings.xml

<resources>
<string name="welcome">स्वागतम</string>
<string name="email">ईमेल पता</string>
<string name="password">पासवर्ड</string>
<string name="login">लॉगिन</string>
<string name="signup">खाता नहीं है? साइन अप करें</string>

values-gu/strings.xml

<resources>
<string name="welcome">પધારો </string>
<string name="email">ઈમૈલ નું નામ</string>
<string name="password">પાસવોર્ડ</string>
<string name="login">લોગીન</string>
<string name="signup">એકાઉન્ટ નથી ? સાઈન ઉપ કરો</string>

values-ja/strings.xml

<resources>
<string name="welcome">歓迎</string>
<string name="email">電子メールアドレス</string>
<string name="password">パスワード</string>
<string name="login">ログイン</string>
<string name="signup">アカウントをお持ちでない場合は?サインアップ</string>

values-ja/strings.xml

<string name="welcome">Willkommen!</string>
<string name="email">Email Addresse</string>
<string name="password">passowrd</string>
<string name="login">Login</string>
<string name="signup">müssen nicht angemeldet? Anmeldung</string>

Upvotes: 1

Nirali
Nirali

Reputation: 13805

You have to use different string.xml files

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

Refer below link

Supporting Different Languages

And also Read Localization

Upvotes: 7

Md Abdul Gafur
Md Abdul Gafur

Reputation: 6201

Create values folder for different language and put this language String.

example : values-ca and put Canada language String in this folder.

So, if user change the phone language then it is show this country language.

Thanks.

Upvotes: 1

Leon Lucardie
Leon Lucardie

Reputation: 9730

The most common to do this is to keep a string file with the strings you want to localize in the res/values folder. You can then create additional values folders marked with resource qualifiers that will contain localized string files.

For example, if you want to translate to german, you create the res/values-de folder and put your localized string file in the folder. Android will load this folder automatically if the language is set to german. If the current system language has no values folder, it will use the default res/values folder.

Upvotes: 2

Igor Konoplyanko
Igor Konoplyanko

Reputation: 9374

Do you really need this to do manually? Actually in android are already built-in internationalization mechanizms - resource qualifiers.

All you need to do is add specific strings.xml for each locale.

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

Upvotes: 0

Related Questions