GetLocaleInfo for other languages?

by Michael S. Kaplan, published on 2007/07/13 16:59 -04:00, original URI:

Serdar asked:


Is it possible to call GetLocaleInfo in a different language? What I’m trying to do is as follows:

  • Installed a Vista English machine.
  • Installed German and Spanish language packs.
  • UI language is set to English.
  • Want to learn what “German” (language name) is in Spanish.

I believe I can do this by loading kernel32.dll and using FindResourceEx to find the language I want. However, I just wanted to learn whether there is a shorter way.


A very good question. And although the FindResourceEx route will work, it has several challenges:

A much cooler way was suggested by Erik Fortune (the MUI development manager):

If GetLocaleInfo follows the UI language, you should(*) be able to set the thread language to “es-ES” and call GetLocaleInfo.

-- Erik

(*) I haven’t actually tried it and can think of a number of ways it might break, but it’s probably your best bet.

It actually does work (though Erik's response may seem to be a blatant contradiction to the first tester's axiom, though in truth the scenario was tested by others so the fact that he had not tried it was just a good reason for a disclaimer!).

All of the following LCType values for GetLocaleInfo/GetLocaleInfoEx can be expected to return localized results that could be impacted by changing a thread's UI language:

As a fun experiment if you have lots of UI languages installed, you can compare the first three values to the following values for that locale in that language:

Any time the translation is different, you have found either a localization bug or a core bug! :-)


This post brought to you by   (U+0f85, a.k.a. TIBETAN MARK PALUTA)

no comments

go to newer or older post, or back to index or month or day