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

一款好的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

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:Age of Ai 设计师:meimeiellie 返回首页
评论

打赏作者

一苇渡江694

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值