1

I have looked over this article regarding globalization in Xamarin Forms. The article indicates I need to create an interface in order to access the language on each platform. However, in my last App, I was able to simply put this line of code in my shared code and it seemed to work fine for getting the language:

ls_Language = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName;

Is there a reason a line of code similar to this wont work for Globalization using a resource file in Xamarin Forms?

York Shen
  • 9,014
  • 1
  • 16
  • 40
George M Ceaser Jr
  • 1,497
  • 3
  • 23
  • 52

1 Answers1

2

Yes, your code is to set resource Culture when the application first loads, it is the same as using the DependencyService in the Xamarin.Forms App class to call the interface and set our RESX resources culture to the correct value.

You may optionally update this value according to platform-specific events that may be raised on iOS or Android if the user updates their language preferences while the app is running. So you need to use ILocalize interface.

Cherry Bu - MSFT
  • 10,160
  • 1
  • 10
  • 16
  • Cherry Bu thank you for the feed back. Correct me if I an wrong but simple re-checking the settings in the App OnResume would also accomplish the same thing correct? I.E. If the user left the app to change their language, the OnResume method would fire when they returned to the app. – George M Ceaser Jr Feb 24 '19 at 22:06