3.15 获取当前设备语言

//示例代码

/*
        typedef enum LanguageType
        {
            kLanguageEnglish = 0, 
            kLanguageChinese,
            kLanguageFrench,
            kLanguageItalian,
            kLanguageGerman,    //德语
            kLanguageSpanish,    //西班牙语
            kLanguageRussian,    
            kLanguageKorean,    //韩国语
            kLanguageJapanese,
            kLanguageHungarian,    //匈牙利语
            kLanguagePortuguese,//葡萄牙语
            kLanguageArabic        //阿拉伯语
        } ccLanguageType;
        */

        //显示当前设备语言
        CCLabelTTF* labelLanguage = CCLabelTTF::create("", "Arial", 20);
        labelLanguage->setPosition(ccp(size.width/2, size.height/2));
        //获取当前语言种类
        ccLanguageType currentLanguageType = CCApplication::sharedApplication()->getCurrentLanguage();
        switch (currentLanguageType)
        {
        case kLanguageEnglish:
            labelLanguage->setString("current language is:English");
            break;
        case kLanguageChinese:
            labelLanguage->setString("current language is:Chinese");
            break;
            //……
        default:
            break;
        }

 

posted @ 2013-11-29 00:21  解放1949  阅读(228)  评论(0编辑  收藏  举报