0

I have got in my strings.xml a string with translations:

default: <string name="help">Help</string>
values-de: <string name="help">Hilfe</string>
values-it: <string name="help">Aiuto</string>

let's say my device is in Italian. My string will look like

Aiuto

let's say I've got a Button below the TextView where "Aiuto" is displayed.

When I press the button I need the string to reset to it's default value, so in this case from

"Aiuto" to "Help"

Is there any way I can do this programatically?

Daniele
  • 4,163
  • 7
  • 44
  • 95

1 Answers1

0

You can set the Locale programmatically using the Locale.setDefault().

Note that the Locale will reset on configuration change. Refer this post on how to handle that: Changing Locale within the app itself

Abhishek Jain
  • 3,562
  • 2
  • 26
  • 44
  • Thanks for the answer. I get it, but I don't need to change the whole app locale. I just some strings to be in English not all of them – Daniele Jul 15 '17 at 19:40
  • 1
    @Daniele Then this answer should definitely help you. https://stackoverflow.com/a/9475663/3857465 – Abhishek Jain Jul 15 '17 at 19:43