2

What I want to do is provide the user with a spinner which contains several languages, when a language is selected, the app will translate to that language.

I have different string files but I have no idea how to implement this. Is this possible? How can I do it?

Nick
  • 8,964
  • 4
  • 26
  • 37
fasheikh
  • 419
  • 3
  • 19
  • Just google "Android i18n" (i18n = internationalization) and you'll get lots of resources, like [this one](http://www.vogella.com/blog/2011/01/17/translating-android-applications-i18n/) – Nick Aug 17 '12 at 13:00
  • chick this [page](http://developer.android.com/training/basics/supporting-devices/languages.html) and this seems to be duplicate of [setting locale programmatically](http://stackoverflow.com/questions/4985805/set-locale-programatically) – nandeesh Aug 17 '12 at 13:00

2 Answers2

4

In the res folder, respect this :

res/
       values/
           strings.xml
       values-es / (here for spanish values)
           strings.xml
       values-fr /
           strings.xml (here for french values)

Android loads the appropriate resources according to the locale settings of the device at run time.

For more informations, see this.

Alexis C.
  • 91,686
  • 21
  • 171
  • 177
0

you just need to put different string.xml files in different values folders each one named like this values-XX where XX is the language to be used.

for examlple values-en for english, values-fr for french, etc..

ColdFire
  • 6,764
  • 6
  • 35
  • 51