2012-04-19 14:35:52 +08:00
|
|
|
#include "CurrentLanguageTest.h"
|
|
|
|
|
|
|
|
CurrentLanguageTest::CurrentLanguageTest()
|
|
|
|
{
|
2014-04-09 23:31:05 +08:00
|
|
|
auto label = Label::createWithTTF("Current language Test", "fonts/arial.ttf", 28);
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(label, 0);
|
2014-08-28 11:41:18 +08:00
|
|
|
label->setPosition(VisibleRect::center().x, VisibleRect::top().y-50);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-04-09 23:31:05 +08:00
|
|
|
auto labelLanguage = Label::createWithTTF("", "fonts/arial.ttf", 20);
|
2012-10-23 17:48:50 +08:00
|
|
|
labelLanguage->setPosition(VisibleRect::center());
|
2014-10-11 15:19:20 +08:00
|
|
|
|
|
|
|
auto labelLanguageCode = Label::createWithTTF("", "fonts/arial.ttf", 20);
|
|
|
|
labelLanguageCode->setPosition(VisibleRect::center().x, VisibleRect::center().y-50);
|
|
|
|
|
|
|
|
const char* currentLanguageCode = Application::getInstance()->getCurrentLanguageCode();
|
|
|
|
|
|
|
|
labelLanguageCode->setString(currentLanguageCode);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-26 17:29:06 +08:00
|
|
|
LanguageType currentLanguageType = Application::getInstance()->getCurrentLanguage();
|
2012-04-19 14:35:52 +08:00
|
|
|
switch (currentLanguageType)
|
|
|
|
{
|
2013-07-26 17:29:06 +08:00
|
|
|
case LanguageType::ENGLISH:
|
2012-04-19 14:35:52 +08:00
|
|
|
labelLanguage->setString("current language is English");
|
|
|
|
break;
|
2013-07-26 17:29:06 +08:00
|
|
|
case LanguageType::CHINESE:
|
2012-04-19 14:35:52 +08:00
|
|
|
labelLanguage->setString("current language is Chinese");
|
|
|
|
break;
|
2013-07-26 17:29:06 +08:00
|
|
|
case LanguageType::FRENCH:
|
2012-04-19 14:35:52 +08:00
|
|
|
labelLanguage->setString("current language is French");
|
|
|
|
break;
|
2013-07-26 17:29:06 +08:00
|
|
|
case LanguageType::GERMAN:
|
2012-04-19 14:35:52 +08:00
|
|
|
labelLanguage->setString("current language is German");
|
|
|
|
break;
|
2013-07-26 17:29:06 +08:00
|
|
|
case LanguageType::ITALIAN:
|
2012-04-19 14:35:52 +08:00
|
|
|
labelLanguage->setString("current language is Italian");
|
|
|
|
break;
|
2013-07-26 17:29:06 +08:00
|
|
|
case LanguageType::RUSSIAN:
|
2012-04-19 14:35:52 +08:00
|
|
|
labelLanguage->setString("current language is Russian");
|
|
|
|
break;
|
2013-07-26 17:29:06 +08:00
|
|
|
case LanguageType::SPANISH:
|
2012-04-19 14:35:52 +08:00
|
|
|
labelLanguage->setString("current language is Spanish");
|
|
|
|
break;
|
2013-07-26 17:29:06 +08:00
|
|
|
case LanguageType::KOREAN:
|
2012-10-19 09:41:46 +08:00
|
|
|
labelLanguage->setString("current language is Korean");
|
|
|
|
break;
|
2013-07-26 17:29:06 +08:00
|
|
|
case LanguageType::JAPANESE:
|
2012-11-28 16:53:10 +08:00
|
|
|
labelLanguage->setString("current language is Japanese");
|
|
|
|
break;
|
2013-07-26 17:29:06 +08:00
|
|
|
case LanguageType::HUNGARIAN:
|
2012-12-05 18:31:05 +08:00
|
|
|
labelLanguage->setString("current language is Hungarian");
|
|
|
|
break;
|
2013-07-26 17:29:06 +08:00
|
|
|
case LanguageType::PORTUGUESE:
|
2013-03-03 10:32:09 +08:00
|
|
|
labelLanguage->setString("current language is Portuguese");
|
|
|
|
break;
|
2013-07-26 17:29:06 +08:00
|
|
|
case LanguageType::ARABIC:
|
2013-03-03 10:32:09 +08:00
|
|
|
labelLanguage->setString("current language is Arabic");
|
|
|
|
break;
|
2013-07-26 17:29:06 +08:00
|
|
|
case LanguageType::NORWEGIAN:
|
2013-05-29 16:31:46 +08:00
|
|
|
labelLanguage->setString("current language is Norwegian");
|
|
|
|
break;
|
2013-07-26 17:29:06 +08:00
|
|
|
case LanguageType::POLISH:
|
2013-06-21 03:15:42 +08:00
|
|
|
labelLanguage->setString("current language is Polish");
|
|
|
|
break;
|
2014-03-05 15:04:30 +08:00
|
|
|
case LanguageType::DUTCH:
|
|
|
|
labelLanguage->setString("current language is Polish");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
CCASSERT(false, "Invalid language type.");
|
|
|
|
break;
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
addChild(labelLanguage);
|
2014-10-11 15:19:20 +08:00
|
|
|
addChild(labelLanguageCode);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void CurrentLanguageTestScene::runThisTest()
|
|
|
|
{
|
2014-08-28 07:31:57 +08:00
|
|
|
auto layer = new (std::nothrow) CurrentLanguageTest();
|
2013-07-23 08:25:44 +08:00
|
|
|
addChild(layer);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-12 06:24:23 +08:00
|
|
|
Director::getInstance()->replaceScene(this);
|
2013-07-23 08:25:44 +08:00
|
|
|
layer->release();
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|