12.cocos2d-x 获取当前设备语言

  
    CCSize size=CCDirector::sharedDirector()->getWinSize();
    CCLabelTTF *labelLanguange=CCLabelTTF::create("", "Arial", 20);
    labelLanguange->setPosition(ccp(size.width/2, size.height/2));
    //获取当前语言种类
    ccLanguageType currentLanguage=CCApplication::sharedApplication()->getCurrentLanguage();
    switch (currentLanguage) {
        case cocos2d::kLanguageEnglish:
            labelLanguange->setString("当前设备语言是:English");
            break;
        case cocos2d::kLanguageChinese:
            labelLanguange->setString("当前设备语言是:Chinese");
            break;
        case cocos2d::kLanguageFrench:
            labelLanguange->setString("当前设备语言是:French");
            break;
        case cocos2d::kLanguageGerman:
            labelLanguange->setString("当前设备语言是:German");
            break;
            
        default:
            break;
    }
    this->addChild(labelLanguange);
12.cocos2d-x 获取当前设备语言_第1张图片

你可能感兴趣的:(12.cocos2d-x 获取当前设备语言)