1

I want to add new supported language to my app.
I saw in the example that i looking that i need to go over all my
activities/fragments and Override all the onConfigurationChanged method and set each controller to the selected language.
I have a lot of Fragments in my app - and i looking for some easy way to do it without go over all my controls in my app.

Is there any other way that can be easy to use then this way ? Is there some auto mode that i set the language in the some config file and all the configuration of the controls are change as the language that was selected

Yanshof
  • 9,659
  • 21
  • 95
  • 195
  • 1
    "I saw in the example that i looking that i need to go over all my activities/fragments and Override all the onConfigurationChanged method and set each controller to the selected language" -- I don't know what "example" you are referring to, but that's not normally how we do it. Instead, we allow the regular destroy/recreate cycle to rebuild our UI with the appropriate string resource values for the locale. – CommonsWare Oct 05 '17 at 15:30
  • so how to do it ? is there any example that i can see because all the examples that i trying are not working well I try this https://stackoverflow.com/questions/2900023/change-language-programmatically-in-android and this is not working – Yanshof Oct 05 '17 at 16:03
  • "so how to do it ?" -- you add translations of your string resources to your app (`res/values-..../strings.xml` for various language-specific values of `...`, such as `es` for Spanish). And you're done. "I try this" -- that is for trying to have a locale separate from what the user chose for the device and where you want to be able to change it on the fly. Very few apps need this. – CommonsWare Oct 05 '17 at 16:22
  • can you add some example that work ? because as i said .. all i try are not working – Yanshof Oct 05 '17 at 18:11
  • Step #1: Create a new Android Studio project. Step #2: Define a string resource with 2+ translations. Step #3: Use that string resource in a `TextView` via `android:text`. And you are done. When you run the app, the `TextView` will show your text based on the available translations and the locale that you choose in the Settings app. – CommonsWare Oct 05 '17 at 18:37
  • you did not understood me - in know how to do it in this way ... i need some simple way beside to go over all the controles – Yanshof Oct 05 '17 at 18:52

0 Answers0