//獲取當前系統的語言 static std::string __CheckLocale() { //LCID 實際是unsignedlong類型,所以可以通過LCID編碼來比較是什么語言 LCID lcid = GetThreadLocale(); wchar_t name[LOCALE_NAME_MAX_LENGTH]; if(LCIDToLocaleName(lcid, name, LOCALE_NAME_MAX_LENGTH, 0) == 0){ // "Get locale name error" } std::wstring ws(name); std::string str(ws.begin(), ws.end()); return str; } std::string locale = __CheckLocale(); if (locale.find("zh") != std::string::npos || locale.find("CN") != std::string::npos) { //中文 }