windows用戶端開發--為國際化做準備

來源:互聯網
上載者:User

標籤:

一款好的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用戶端開發--為國際化做準備

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.