C++ 用于获取操作系统语言(本地化信息)的 Win32 API?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1322578/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Win32 API for getting the language(localization info) of the OS?
提问by sourabh jaiswal
Can anybody please help me with how to get the language(english,chinese etc) of Windows OS through win32 API(C/C++)??
任何人都可以帮助我如何通过 win32 API(C/C++) 获取 Windows 操作系统的语言(英语、中文等)?
Thanks, Sourabh
谢谢,苏拉布
采纳答案by Xiaofu
You can get the default user locale (which I think is what you're asking) using GetUserDefaultLCID. This will give you an ID which can be used to determine the culture. See herefor a table containing IDs and the cultures they represent.
您可以使用GetUserDefaultLCID获取默认用户语言环境(我认为这就是您要问的)。这将为您提供可用于确定文化的 ID。请参阅此处获取包含 ID 及其代表的文化的表格。
For Vista or Windows 7, Microsoft recommend GetUserDefaultLocaleName.
对于 Vista 或 Windows 7,Microsoft 建议使用GetUserDefaultLocaleName。
回答by MaxVT
If you're asking about "Which language the OS menus and dialogs are dispalyed in" (i.e. which MUI - Multilingual User Interface kit - is installed), use the following:
如果您询问“操作系统菜单和对话框显示的语言”(即安装了哪种 MUI - 多语言用户界面工具包),请使用以下命令:
- GetSystemDefaultUILanguageto get the original language of the system,
- GetUserDefaultUILanguageto get the current user's selection,
- EnumUILanguagesto see which languages are available.
- GetSystemDefaultUILanguage获取系统的原始语言,
- GetUserDefaultUILanguage获取当前用户的选择,
- EnumUILanguages以查看可用的语言。
More info:
更多信息: