cocos2dx 获取设备的当前语言

//     获取当前设备的语言

    

    CCSize size= CCDirector::sharedDirector()->getWinSize();

//    这个是显示当前设备

    CCLabelTTF * labelLanguage = CCLabelTTF::create("", "", 20);

 

    labelLanguage->setPosition(ccp(size.width* 0.5, size.height*0.5));

    

//    获取语言

    

    ccLanguageType la = CCApplication::sharedApplication()->getCurrentLanguage();

     

    switch (la)

    {

        case kLanguageEnglish:

            labelLanguage->setString("当前设备语言是: English");

            break;

        case kLanguageChinese:

            labelLanguage->setString("当前设备语言是: Chinese");

            break;

        case kLanguageFrench:

            labelLanguage->setString("当前设备语言是: French");

            break;

        case kLanguageGerman:

            labelLanguage->setString("当前设备语言是: German");

            break;

        case kLanguageItalian:

            labelLanguage->setString("当前设备语言是: Italian");

            break;

        case kLanguageRussian:

            labelLanguage->setString("当前设备语言是: Russian");

            break;

        case kLanguageSpanish:

            labelLanguage->setString("当前设备语言是: Spanish");

            break;

    }

    addChild(labelLanguage);

 

你可能感兴趣的:(cocos2dx)