0

Is there a way to add localization setting in my app? I'm going to add a preference/setting in my app and there is a localization option. So the user can change the language I have provided from the values string. I was googling around but found nothing. Wondering you guys can help me, and give example or link to the tutorial.

IrvanFza
  • 180
  • 2
  • 15
  • Possible duplicate http://stackoverflow.com/questions/2900023/change-language-programatically-in-android – David Jashi Jun 25 '13 at 09:16
  • check this link ... mabe it will help you ...: http://stackoverflow.com/questions/2900023/change-language-programatically-in-android –  Jun 25 '13 at 09:18
  • check this link ... mabe it will help you ...: http://stackoverflow.com/questions/2900023/change-language-programatically-in-android –  Jun 25 '13 at 09:19

1 Answers1

0

You don't need to provide a setting for that, Android will do that for you. You just have to provide the translations for the languages you want to support.

You can do this for French for example by creating a folder named res/values-fr in your resources folder and putting your translations in there.

so in the res/values folder you would have a strings.xml file :

 <?xml version="1.0" encoding="utf-8"?>
 <resources>
   <string name="q_map">Map</string>
 </resources>

and in the res/values-fr you woud have another string.xml file :

<?xml version="1.0" encoding="utf-8"?>
 <resources>
   <string name="q_map">Carte</string>
 </resources>

Your app will use the translation that best matches the language that the user has selected on their device.

Plato
  • 2,338
  • 18
  • 21