首页 > Windows开发 > 详细

windows客户端开发--为国际化做准备

时间:2016-03-20 00:45:13      阅读:427      评论:0      收藏:0      [点我收藏+]

一款好的windows client,当然要做国际化。

今天先介绍几个函数,获取windows操作系统的使用语言。

GetSystemDefaultLCID函数
这个函数很简单,没有参数,只有返回值:
Returns the locale identifier for the system locale

GetSystemDefaultUILanguage

Retrieves the language identifier for the system default UI language of the operating system, also known as the "install language" on Windows Vista and later. For more information, see User Interface Language Management.

GetUserDefaultUILanguage
Returns the language identifier for the user UI language for the current user. If the current user has not set a language, GetUserDefaultUILanguage returns the preferred language set for the system. If there is no preferred language set for the system, then the system default UI language (also known as “install language”) is returned. For more information about the user UI language, see User Interface Language Management.
原型:

LANGID GetUserDefaultUILanguage(void);
#include<iostream>
#include<Windows.h>
#pragma comment(lib, "Kernel32.lib")
int main()
{
    auto iter = GetUserDefaultUILanguage();
    auto iter2 = GetSystemDefaultUILanguage();
    std::cout << iter << std::endl;
    std::cout << iter2 << std::endl;
    return 0;
}
//输出:
//2052
//2052

返回值LANGID 是什么:

Arabic
1025
Arabic

Basque
1069
ANSI

Catalan
1027
ANSI

Chinese (Simplified)
2052
GB2312

Chinese (Traditional)
1028
Chinese-Big 5

Czech
1029
Eastern European

Danish
1030
ANSI

Dutch
1043
ANSI

English (United States)
1033
ANSI

Finnish
1035
ANSI

French
1036
ANSI

German
1031
ANSI

Greek
1032
Greek

Hebrew
1037
Hebrew

Hungarian
1038
Eastern European

Italian
1040
ANSI

Japanese
1041
Shift-JIS

Korean
1042
Johab

Norwegian
1044
ANSI

Polish
1045
Eastern European

Portuguese
2070
ANSI

Portuguese (Brazil)
1046
ANSI

Russian
1049
Russian

Slovakian
1051
Eastern European

Slovenian
1060
Eastern European

Spanish
3082
ANSI

Swedish
1053
ANSI

Turkish
1055
Turkish

另外,如果vs出现这样的错误:
error LNK2001: 无法解析的外部符号 _WinMain@16

链接器-系统-子系统-选择工作台

windows客户端开发--为国际化做准备

原文:http://blog.csdn.net/wangshubo1989/article/details/50934040

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!