From MSDN about the FormatMessage function:
If you pass in zero,
FormatMessage
looks for a message forLANGIDs
in the following order:
- Language neutral
- Thread
LANGID
, based on the thread's locale value- User default
LANGID
, based on the user's default locale value- System default
LANGID
, based on the system default locale value- US English
But zero is Language neutral already, because the value of Language neutral is 0...
LCID lang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL); // 0
What is the Language neutral? Is it the same for any computer? If "yes" then is it en-US
?
Also what is the System default LANGID
? Is it the same like on the screen?
Also what is the User default LANGID
? What distinction between these three localizations? Where their values are stored in the Windows OS settings?
The MSDN documentation for FormatMessage could be easier to understand if it said language-neutral instead of Language neutral. Windows MUI resources can be language-specific or language-neutral (you can learn more about this topic here). Calling FormatMessage with dwLanguageId=0
tells Windows to try to load a string with the given dwMessageID
from the language-neutral resources. If the string does not exist in the language-neutral resources Windows will try to load it from language-specific resources, using the documented order of LANGIDs (thread default, user default, system default, 1033). This is a bit unusual because the process default LANGID is not considered.
The User default LANGID is what you get back from calling GetUserDefaultUILanguage. You can change it in the Control Panel (for Windows 8.1: Control Panel\Clock, Language, and Region\Language). GetSystemDefaultUILanguage returns the System default LANGID. I would expect that you can change it on the screen that you posted, but I am not sure if the upper or the lower button is the right one. I am afraid I don't know where these settings are stored.
According to leaked Windows XP source code (NT/base/ntos/rtl/ldrrsrc.c
):
// If search path includes a language id, then attempt to
// match the following language ids in this order:
//
// (0) use given language id
// (1) use primary language of given language id
// (2) use id 0 (neutral resource)
// (3) use thread language id for console app
//
// If the PRIMARY language id is ZERO, then ALSO attempt to
// match the following language ids in this order:
//
// (4) use user UI language
// (5) use lang id of TEB for windows app if it is different from user locale
// (6) use UI lang from exe resource
// (7) use primary UI lang from exe resource
// (8) use Install Language
// (9) use lang id from user's locale id
// (10) use primary language of user's locale id
// (11) use lang id from system default locale id
// (12) use lang id of system default locale id
// (13) use primary language of system default locale id
// (14) use US English lang id
// (15) use any lang id that matches requested info
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With