1

My app supports multiple languages(values-es, values-de...) But how can add option to override that

For example:

user has set its system language to English so my app will use default values folder.

I want to add option so that it can select any of the languages available in my app.

If user selects German(in my app not in system settings) it will use strings from values-de

Is there a way to do that?

4
  • 1
    See: stackoverflow.com/questions/11155623/… Commented Nov 16, 2012 at 13:35
  • 1
    developer.android.com/guide/topics/resources/localization.html Commented Nov 16, 2012 at 13:36
  • Thanks Configuration configuration = context.getResources().getConfiguration(); configuration.locale = new Locale(selectedLanguage); context.getResources().updateConfiguration(configuration, context.getResources().getDisplayMetrics()); This worked from first link Commented Nov 16, 2012 at 13:52
  • I knew I was forgetting something. I was just about to edit my answer with that then I saw the comment. Glad you got it working :) Commented Nov 16, 2012 at 13:56

1 Answer 1

1

I have just done this for my app. Everything I have read says that it is not a good idea as the Android framework doesn't support it and there may be bugs in the future. Nonetheless, I was told this is how we wanted to do it and so I did. So far, mine is working fine for Spanish. You will need to add

android:configChanges="orientation|locale"> 

in all of your activities. You may not need the orientation but I did so that the language would stay if the device is turned. You also may have to do some other work such as setting the language in your onCofigChanged in activities...at least I did. There may be a better way to do it but this is how I got it to work. Good luck

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.