1

I've been searching msdn forever now without a straight answer.

Is there a way to simply get the user's language? I don't want to load any resources or anything at this point, I just want to get their language. Is there ANY simple way to do this?

I'm using visual C++,and I'm not using MFC or anything like that.

Machavity
  • 30,841
  • 27
  • 92
  • 100
Mark
  • 2,082
  • 3
  • 17
  • 30

3 Answers3

8

What about GetUserDefaultUILanguage?

Word of caution: Never mistake the user's locale for their UI language. There are already enough broken applications out there.

Joey
  • 344,408
  • 85
  • 689
  • 683
  • 6
    The *locale* governs things like how numbers and dates are formatted, what collation is used for string sorting and the like. The *UI language* obviously just specifies what language the user interface is displayed in. Those two things are separate concepts since Windows 2000 on Windows and should be treated like that. I for example use a German locale (customized to use a sane date format [ISO 8601]) and an English UI language (so that I don't have to put up with idiotic translations). – Joey Jun 22 '10 at 17:11
  • Considering that you tagged the question with `MUI` I assumed you'd be aware of the difference, though. – Joey Jun 22 '10 at 17:13
  • What's the difference between GetUserDefaultUILanguage and GetUserDefaultLangID? – spinon Jun 24 '10 at 15:56
2

GetUserDefaultLangID may be what you're after. Then again, you may really be after GetUserPreferredUILanguages.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
0

GetUserDefaultLCID or GetUserDefaultLocaleName on Vista will return the LCID/locale name of the user's default locale.

You can then use GetLocaleInfo or GetLocaleInfoEx on Vista to get the display name of the locale (either LOCALE_SENGLISHDISPLAYNAME for the english name or LOCALE_SLOCALIZEDDISPLAYNAME for the localized name).

Dean Harding
  • 71,468
  • 13
  • 145
  • 180