问题
How could I get the current language of the device in Xamarin (for Android)?
Got the language with context.Resources.Configuration.Locale.Language
回答1:
Here's a cross platform version I use. Obviously you can pull whatever property you need from CurrentUICulture
.
return CultureInfo.CurrentUICulture.TwoLetterISOLanguageName;
Maybe it will help someone else.
回答2:
This appears to be what you are looking for: http://androidapi.xamarin.com/?link=T%3aSystem.Globalization.RegionInfo
The RegionInfo class appears to have access for various ways to read that language information and use in your comparisons.
Based on this question, I went to the Xamarin documentation looking for the answer: Get the current language in device
来源:https://stackoverflow.com/questions/15618699/in-xamarin-how-to-get-the-current-language-of-the-device-for-android