获取当前设备语言

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

    //用于显示当前设备语言

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

    labelLanguage->setPosition(ccp(s.width/2, s.height/2));

    //获取当前语言种类

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

    switch (currentLanguageType)

    {

        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);

你可能感兴趣的:(cocos2d-x)