How to get the Windows Phone system language from code?

mobile app Beginner picture mobile app Beginner · Jan 25, 2013 · Viewed 7.2k times · Source

Solution: Use CultureInfo.CurrentUICulture

User can change the system language of Windows Phone at: Settings > language+region > Phone language

How can I get the selected language (Phone language) from C# code?

Below is my phone settings:

Here is my code snippet:

System.Diagnostics.Debug.WriteLine(
    "*************************************   CultureInfo.CurrentCulture.Name = " + CultureInfo.CurrentCulture.ToString() + ", "  +
    "CultureInfo.CurrentCulture.CompareInfo = " + CultureInfo.CurrentCulture.CompareInfo + ", " +
    "CultureInfo.CurrentCulture.DisplayName = " + CultureInfo.CurrentCulture.DisplayName + ", " +
    "CultureInfo.CurrentCulture.EnglishName = " + CultureInfo.CurrentCulture.EnglishName + ", " +
    "CultureInfo.CurrentCulture.Name = " + CultureInfo.CurrentCulture.Name + ", " +
    "CultureInfo.CurrentCulture.NativeName = " + CultureInfo.CurrentCulture.NativeName + ", " +
    "CultureInfo.CurrentCulture.TextInfo = " + CultureInfo.CurrentCulture.TextInfo
);

Here is the output:

CultureInfo.CurrentCulture.Name = zh-HK,
CultureInfo.CurrentCulture.CompareInfo = CompareInfo - zh-HK,
CultureInfo.CurrentCulture.DisplayName = Chinese (Traditional, Hong
Kong SAR), CultureInfo.CurrentCulture.EnglishName = Chinese
(Traditional, Hong Kong SAR), CultureInfo.CurrentCulture.Name = zh-HK,
CultureInfo.CurrentCulture.NativeName = 中文(香港特別行政區),
CultureInfo.CurrentCulture.TextInfo = TextInfo - zh-HK

I cannot find the 'Phone Language'

Answer

Claus Jørgensen picture Claus Jørgensen · Jan 25, 2013

Use System.Threading.Thread.CurrentThread.CurrentCulture. It should correctly reflect the phone language.