Share via


How to get user's current input locale?

Windows supports number of locales installed on the same computer. Current input locale could be important in some cases, for example in password request dialogs. Here is how you can find active locale in your WinForms App to warn user and prevent wrong submitting.

 

 // As a string (e.g. "en"):
 string currentISOLangStr = InputLanguage.CurrentInputLanguage.Culture.TwoLetterISOLanguageName;
 
 // As an integer (e.g. 1033)
 int currentLangId = InputLanguage.CurrentInputLanguage.Culture.KeyboardLayoutId;
 

 

By the way, Windows does that in login window.

Technorati Tags: Globalization,C#

Comments