Getting the Windows Startup Message Language
I am currently trying to get hold of the MUI and getting some problems with GetSystemDefaultUILanguage - this does not return the expected language:
Users can set the language used to start Windows in the Welcome and New User Account Settings dialog box, which claims to copy the language settings to the system accounts. So I could get the language used when running the messages using GetSystemDefaultUILanguage, but it only seems to come back with the language used for the initial OS installation. How can I get the language of the startup messages?
source to share
It looks like GetSystemDefaultUILanguage returns the language the OS was installed in. In 2K8 R2, at least (and possibly other OSs after Vista), users can change the language used to load messages, but this is unfortunately not reflected in GetSystemDefaultUILanguage.
However, it can be viewed through the registry. The following value stores a textual description (for example, en-US) of the language:
This value is displayed only on computers with multiple languages installed (and possibly only when the user has changed the greeting language).
So, to get the current greeting language, the flow looks like this:
- Trying to read PreferredUILanguages
- If found, parse language id
- Otherwise call GetSystemDefaultUilanguage
- Load the appropriate language resources given the returned language ID
It wouldn't be such a pain if we weren't trying to display things in a different language at boot time! Usually you can just use GetUserDefaultUilanguage.
source to share