In cocos2d-x, the following methods can be used to determine whether it is Chinese or other languages
//default language is local language ccLanguageType currentLanguageType = CCApplication::sharedApplication()->getCurrentLanguage(); switch (currentLanguageType) { case kLanguageEnglish: language_ = "english"; break; case kLanguageChinese: language_ = "zhcn"; break; default: language_ = "english"; break; } }
However, I want to judge whether it is simplified Chinese, or traditional Chinese, turning over the cocos2d-x of the definition of cclanguagetype inside oh.
Ccapplication: sharedapplication ()-> getcurrentlanguage (); the following method is changed. So I found the method.
// Whether it is a traditional Chinese bool container agemanager: istaiwanchinese () {// get the current language and country config nsuserdefaults * defaults = [nsuserdefaults standarduserdefaults]; nsarray * Languages = [ults objectforkey: @ "applelanguages"]; nsstring * currentlanguage = [ages objectatindex: 0]; If ([currentlanguage istattostring: @ "ZH-HANT"]) {return true ;} else {return false ;}}
Then, you can use the following code to determine whether it is simplified Chinese or traditional Chinese.
// Default language is local language ccLanguageType current1_agetype = CCApplication: sharedApplication ()-> getCurrentLanguage (); switch (current1_agetype) {case k1_ageenglish: language _ = "english"; break; case kmeanagechinese: // determine whether it is simplified or traditional. // if it is traditional, if (isTaiWanChinese () = true) {language _ = "zhcnt ";} // It is a simplified else {language _ = "zhcn" ;}break; default: language _ = "english"; break ;}}