mahen
mahen

Reputation: 175

Why C# CultureInfo.CurrentCulture give en_US in Window-7 Japanese culture?

I have window-7 Ultimate OS.I written below code for get current culture info.

        void TestMessage()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;
            CultureInfo culture1 = Thread.CurrentThread.CurrentCulture;
        }

it is working fine with window-8,server 2012 Japanese OS. But it is not working in window-7 only. Please look below image of my computer region settingenter image description here

Can any anyone guide me to get correct culture name?

Thanks,

Upvotes: 0

Views: 748

Answers (1)

Thomas
Thomas

Reputation: 432

There's CurrentCulture and CurrentUICulture.

  • CurrentCulture: formatting of data (numbers, dates), it is configured in Windows using the tab visible in your screenshot
  • CurrentUICulture: the language to speak/write to your user, it is configured in Windows using one of the other tabs showing in your screenshot. ("Keyboard & Languages" I think)

Your screenshot:

  • ... is showing american numeric notation because CurrentCulture is set to en-US
  • ... is talking Japanese because CurrentUICulture is very likely set to Japanese

So, if you need to know what language to use for localization, as is probably your case, you should be using CurrentUICulture.

Upvotes: 1

Related Questions