0

In Xamarin.Android I have String resource translated in German and a default English translation. While the app is running it only obtains strings in German. How do I make it obtain the English translation instead without changing device's locale?

<string name="exampleResource">Example string</string>

<string name="exampleResource">Beispiel string</string>

I need the second translation shown in Xamarin application at runtime.

bigb055
  • 198
  • 3
  • 14

1 Answers1

0

Have you tried changing the culture of you resx object?

 AppResources.Culture = new CultureInfo("en-EN");
Uraitz
  • 476
  • 4
  • 12
  • Following isn't working: ```CultureInfo englishGBCulture = new CultureInfo("en-GB"); CultureInfo.DefaultThreadCurrentCulture = englishGBCulture; CultureInfo.DefaultThreadCurrentUICulture = englishGBCulture; Thread.CurrentThread.CurrentCulture = englishGBCulture; Thread.CurrentThread.CurrentUICulture = englishGBCulture;``` – bigb055 Jun 28 '19 at 12:55
  • sorry I ddn`t read that you are workin in native xamarin. I think that this post can help you for update your resources after culture thread is changed https://stackoverflow.com/questions/2644377/changing-locale-force-activity-to-reload-resources – Uraitz Jun 28 '19 at 13:06
  • Can't I just specify the culture for the value returned by GetString() instead of changing the language for the whole app, i. e. AppResources.ResourceManager.GetString(index, AppResources.Culture)? – bigb055 Jun 28 '19 at 16:17