1.cocos2dx获取设备语言的方法:CCApplication::sharedApplication()->getCurrentLanguage()
2.cocos2dx 2.1.4支持识别的语言可在ccLanguageType中查看。以下是ccLanguageType的所以枚举语言。
kLanguageEnglish = 0,
kLanguageChinese,
kLanguageFrench,
kLanguageItalian,
kLanguageGerman,
kLanguageSpanish,
kLanguageRussian,
kLanguageKorean,
kLanguageJapanese,
kLanguageHungarian,
kLanguagePortuguese,
kLanguageArabic
3. getDeviceLanguage()是我封装的一个函数,方便使用!
void HelloWorld::getDeviceLanguage(){
ccLanguageType deviceLanguage=CCApplication::sharedApplication()->getCurrentLanguage();
switch (deviceLanguage) {
case kLanguageChinese:
CCLog("中文");
break;
case kLanguageEnglish:
CCLog("英文");
break;
case kLanguageFrench:
CCLog("法文");
break;
case kLanguageItalian:
CCLog("意大利文");
break;
case kLanguageGerman:
CCLog("");
break;
case kLanguageSpanish:
CCLog("西班牙文");
break;
case kLanguageRussian:
CCLog("俄文");
break;
case kLanguageKorean:
CCLog("韩文");
break;
case kLanguageJapanese:
CCLog("日文");
break;
case kLanguageHungarian:
CCLog("匈牙利文");
break;
case kLanguagePortuguese:
CCLog("葡萄牙文");
break;
case kLanguageArabic:
CCLog("阿拉伯文");
break;
}
}