views:

69

answers:

3

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.

Thanks in advance!

+1  A: 

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
What's the difference?
spinon
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
Considering that you tagged the question with `MUI` I assumed you'd be aware of the difference, though.
Joey
What's the difference between GetUserDefaultUILanguage and GetUserDefaultLangID?
spinon
A: 

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

Jerry Coffin
A: 

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
That's the locale. Not the language.
Joey