From: Mihai N. on

> LCID lcid = ::GetThreadLocale() & 0x00ff;

What you need is LANGIDFROMLCID :-)
http://msdn.microsoft.com/en-us/library/dd318689%28v=VS.85%29.aspx


> lcid |= lcid == 0x0004?0x0800:0x0400; // Chinese starts with 08, but all
> others 04
....
> But we don't use the sub language since we don't support anything except a
> few top level languages.

Actually, you are trying to get the language.

For Chinese that is not enough, you have to look at the region.
That's because Chinese Traditional (usualy mapped to Chinese-Taiwan)
and Chinese Simplified (usualy mapped to Chinese-China) are not mutualy
inteligible.

It works just because you did not have to deal with other languages
that can be written with different scripts.
Examples:
- Azeri, Bosnian, Serbian, Uzbek (Cyrillic and Latin)
- Inuktitut (Latin and Inuktitut Syllabics)
- Mongolian (Cyrillic and Mongolian)
In fact, even the localizations for Portuguese Portugal and
Portuguese Brazil should be different, because they are kind of far,
even with if they use the same script.

Another problem is that language identifiers for
Bosnian, Croatian, and Serbian are numerically identical.
To differenciate between these languages you *must* look at the sublang.


--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

From: Mihai N. on
> How can I detect Windows system language or codepage by Win32 or MFC ?

@All :-)

Before answering, he should make sure he knows what he wants.

In the MS lingo, "Windows system language" is the one that determines the
ANSI/OEM code pages. It is not good to decide the UI language, or to format
stuff with it in a locale-sensitive manner.
It is different than the one from GetThreadLocale or GetUserDefaultLCID.


--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email