Cocos2d-x 学习篇-----------获取当前语言

bool MyScene::init()
{
	CCSize size = CCDirector::sharedDirector()->getWinSize();  // 屏幕大小
	CCLabelTTF *label = CCLabelTTF::create("","Consolas",25);
	label->setPosition(ccp(size.width/2,size.height/2));
	addChild(label);

	LanguageType lanType = CCApplication::sharedApplication()->getCurrentLanguage();  //单例模式
	switch(lanType)
	{
	case kLanguageEnglish: 
		label->setString("Current language is English");
		break;
	case kLanguageChinese:
		label->setString("Current language is Chinese");
		break;

	}

	return true;
}

你可能感兴趣的:(Cocos2d-x 学习篇-----------获取当前语言)