3

Seems there is two cultures(languages) installed on the Windows. For example en-us (English) and Chinese and we can changed the language by Alt+Shift as you know. I need to show the selected language. For example if Chinese is selected when I click on a button on windows form, a massage box show me Chinese is selected. Like this:

if(culture == "en_us")
{
    messagebox.show("English");
}
else
{
    messageBox.show("Chinese");*
}
Veve
  • 6,643
  • 5
  • 39
  • 58
UserMat
  • 600
  • 4
  • 10
  • 27
  • Possible duplicate of [Get current language in cultureinfo](http://stackoverflow.com/questions/4208244/get-current-language-in-cultureinfo) – gravity Jul 20 '16 at 19:53
  • @gravity This only show me the additional installed language and not the selected current language. – UserMat Jul 20 '16 at 19:56
  • `CultureInfo.CurrentCulture`? `InstalledUICulture` should be the list, per se... not the other way around? The same question has yet another answer, detailing how to change the culture for that specific thread-only : `System.Globalization.CultureInfo.DefaultThreadCurrentCulture=CultureInfo.InstalledUICulture;` – gravity Jul 20 '16 at 20:08

2 Answers2

1

Use CultureInfo object that represents the culture used by the current thread.

CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;

Hope it helps.

Saket Choubey
  • 916
  • 6
  • 11
0

You may want to look at get the current selected language of the language bar in windows 7 and modern WinAPI docs.

And at this doc https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.keyboardlayoutid(v=vs.110).aspx

If I understand you correctly it will help you to achieve you goal (KeyboardLayoutId will probably lead you there, sorry, I can't test it right now).

Community
  • 1
  • 1