cocos2d-x 判断系统语言

转自:http://blog.csdn.net/tangaowen/article/details/8878193

//default language is local language
ccLanguageType currentLanguageType = CCApplication::sharedApplication()->getCurrentLanguage();
switch (currentLanguageType)
{
case kLanguageEnglish:
language_ = "english";
break;
case kLanguageChinese:
//判断是否是简体的还是繁体的 //如果是繁体的
if (is*Chinese() == true)
{
language_ = "zhcnt";
}
//是简体的
else
{
language_ = "zhcn";
} break; default:
language_ = "english";
break;
}
} //是否是繁体中文
bool LanguageManager::is*Chinese()
{
// get the current language and country config
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *languages = [defaults objectForKey:@"AppleLanguages"];
NSString *currentLanguage = [languages objectAtIndex:]; if ( [currentLanguage isEqualToString:@"zh-Hant"])
{
return true;
}
else
{
return false;
} }
上一篇:Fisher–Yates shuffle 洗牌算法(zz)


下一篇:2018-2019-2 20165303《网络攻防技术》Exp5 MSF基础应用