Reputation: 229
I need to know what language is used on a iOS/Android device because I build a MonoGame application in Xamarin Studio that supports three different languages. If the current language of the device is english, than the app will show texts in english, but if the current language of the device is french, than the texts will get displayed in french instead of english. If the current language of the device is not supported in my application(for example chinese), than the default language for the texts will be english.
How can I get the current device language on iOS/Android in Xamarin Studio?
Upvotes: 5
Views: 3434
Reputation: 2708
You could use CultureInfo:
CultureInfo.CurrentCulture.TwoLetterISOLanguageName
Plus is cross-platform.
Upvotes: 7
Reputation: 8090
To get the language programmatically, on Android you can use:
Locale.Default.GetDisplayLanguage(Locale.Default)
On iOS :
var userLang = NSLocale.CurrentLocale.LocaleIdentifier;
Upvotes: 4