標籤:
一款好的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: 無法解析的外部符號 [email protected]
連結器-系統-子系統-選擇工作台
windows用戶端開發--為國際化做準備