13

How could I get the current language of the device in Xamarin (for Android)?

Got the language with context.Resources.Configuration.Locale.Language

Cfun
  • 8,442
  • 4
  • 30
  • 62
user769923
  • 247
  • 1
  • 5
  • 15

2 Answers2

30

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.

Misa Lazovic
  • 2,805
  • 10
  • 32
  • 38
Eric LeVan
  • 411
  • 4
  • 5
1

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

Community
  • 1
  • 1
Martin
  • 1,914
  • 1
  • 12
  • 14
  • Thanks Martin. The RegionInfo can get me some region names. I have got the current language by context.Resources.Configuration.Locale.Language. – user769923 Mar 26 '13 at 08:51