pedja
pedja

Reputation: 3413

How to override language

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?

Upvotes: 1

Views: 112

Answers (1)

codeMagic
codeMagic

Reputation: 44571

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

Upvotes: 1

Related Questions