mirror of https://github.com/axmolengine/axmol.git
Merge pull request #2317 from dumganhar/master
fixed #2005: Adding CurrentLanguageTest for Testlua.
This commit is contained in:
commit
7939a214a2
|
@ -0,0 +1,47 @@
|
||||||
|
local function CurrentLanguageTest()
|
||||||
|
local ret = CCLayer:create()
|
||||||
|
local label = CCLabelTTF:create("Current language Test", "Arial", 28)
|
||||||
|
ret:addChild(label, 0)
|
||||||
|
label:setPosition( ccp(VisibleRect:center().x, VisibleRect:top().y-50) )
|
||||||
|
|
||||||
|
local labelLanguage = CCLabelTTF:create("", "Arial", 20)
|
||||||
|
labelLanguage:setPosition(VisibleRect:center())
|
||||||
|
|
||||||
|
local currentLanguageType = CCApplication:sharedApplication():getCurrentLanguage()
|
||||||
|
|
||||||
|
if currentLanguageType == kLanguageEnglish then
|
||||||
|
labelLanguage:setString("current language is English")
|
||||||
|
elseif currentLanguageType == kLanguageChinese then
|
||||||
|
labelLanguage:setString("current language is Chinese")
|
||||||
|
elseif currentLanguageType == kLanguageFrench then
|
||||||
|
labelLanguage:setString("current language is French")
|
||||||
|
elseif currentLanguageType == kLanguageGerman then
|
||||||
|
labelLanguage:setString("current language is German")
|
||||||
|
elseif currentLanguageType == kLanguageItalian then
|
||||||
|
labelLanguage:setString("current language is Italian")
|
||||||
|
elseif currentLanguageType == kLanguageRussian then
|
||||||
|
labelLanguage:setString("current language is Russian")
|
||||||
|
elseif currentLanguageType == kLanguageSpanish then
|
||||||
|
labelLanguage:setString("current language is Spanish")
|
||||||
|
elseif currentLanguageType == kLanguageKorean then
|
||||||
|
labelLanguage:setString("current language is Korean")
|
||||||
|
elseif currentLanguageType == kLanguageJapanese then
|
||||||
|
labelLanguage:setString("current language is Japanese")
|
||||||
|
elseif currentLanguageType == kLanguageHungarian then
|
||||||
|
labelLanguage:setString("current language is Hungarian")
|
||||||
|
elseif currentLanguageType == kLanguagePortuguese then
|
||||||
|
labelLanguage:setString("current language is Portuguese")
|
||||||
|
elseif currentLanguageType == kLanguageArabic then
|
||||||
|
labelLanguage:setString("current language is Arabic")
|
||||||
|
end
|
||||||
|
ret:addChild(labelLanguage)
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
function CurrentLanguageTestMain()
|
||||||
|
local scene = CCScene:create()
|
||||||
|
local pLayer = CurrentLanguageTest()
|
||||||
|
scene:addChild(pLayer)
|
||||||
|
scene:addChild(CreateBackMenuItem())
|
||||||
|
return scene
|
||||||
|
end
|
|
@ -30,6 +30,7 @@ require "luaScript/FontTest/FontTest"
|
||||||
require "luaScript/CocosDenshionTest/CocosDenshionTest"
|
require "luaScript/CocosDenshionTest/CocosDenshionTest"
|
||||||
require "luaScript/EffectsAdvancedTest/EffectsAdvancedTest"
|
require "luaScript/EffectsAdvancedTest/EffectsAdvancedTest"
|
||||||
require "luaScript/UserDefaultTest/UserDefaultTest"
|
require "luaScript/UserDefaultTest/UserDefaultTest"
|
||||||
|
require "luaScript/CurrentLanguageTest/CurrentLanguageTest"
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,7 +79,7 @@ local _allTests = {
|
||||||
{ isSupported = true, name = "UserDefaultTest" , create_func= UserDefaultTestMain },
|
{ isSupported = true, name = "UserDefaultTest" , create_func= UserDefaultTestMain },
|
||||||
{ isSupported = false, name = "BugsTest" , create_func= BugsTestMain },
|
{ isSupported = false, name = "BugsTest" , create_func= BugsTestMain },
|
||||||
{ isSupported = true, name = "FontTest" , create_func = FontTestMain },
|
{ isSupported = true, name = "FontTest" , create_func = FontTestMain },
|
||||||
{ isSupported = false, name = "CurrentLanguageTest" , create_func= CurrentLanguageTestMain },
|
{ isSupported = true, name = "CurrentLanguageTest" , create_func= CurrentLanguageTestMain },
|
||||||
{ isSupported = false, name = "TextureCacheTest" , create_func= TextureCacheTestMain },
|
{ isSupported = false, name = "TextureCacheTest" , create_func= TextureCacheTestMain },
|
||||||
{ isSupported = false, name = "ExtensionsTest" , create_func= ExtensionsTestMain },
|
{ isSupported = false, name = "ExtensionsTest" , create_func= ExtensionsTestMain },
|
||||||
{ isSupported = false, name = "ShaderTest" , create_func= ShaderTestMain },
|
{ isSupported = false, name = "ShaderTest" , create_func= ShaderTestMain },
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
2616adaaf5ef1c788148f07aa3e04b87987a67b1
|
bc76dfef9a8f80745261d850ff9742dc48aa714e
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
typedef enum LanguageType
|
typedef enum LanguageType
|
||||||
{
|
{
|
||||||
kLanguageEnglish = 0,
|
kLanguageEnglish = 0,
|
||||||
|
@ -10,7 +9,9 @@ typedef enum LanguageType
|
||||||
kLanguageRussian,
|
kLanguageRussian,
|
||||||
kLanguageKorean,
|
kLanguageKorean,
|
||||||
kLanguageJapanese,
|
kLanguageJapanese,
|
||||||
kLanguageHungarian
|
kLanguageHungarian,
|
||||||
|
kLanguagePortuguese,
|
||||||
|
kLanguageArabic
|
||||||
} ccLanguageType;
|
} ccLanguageType;
|
||||||
|
|
||||||
enum TargetPlatform
|
enum TargetPlatform
|
||||||
|
|
Loading…
Reference in New Issue