mirror of https://github.com/axmolengine/axmol.git
commit
c3a5e870af
|
@ -64,7 +64,8 @@ typedef enum LanguageType
|
||||||
kLanguageGerman,
|
kLanguageGerman,
|
||||||
kLanguageSpanish,
|
kLanguageSpanish,
|
||||||
kLanguageRussian,
|
kLanguageRussian,
|
||||||
kLanguageKorean
|
kLanguageKorean,
|
||||||
|
kLanguageJapanese
|
||||||
} ccLanguageType;
|
} ccLanguageType;
|
||||||
|
|
||||||
// end of platform group
|
// end of platform group
|
||||||
|
|
|
@ -112,6 +112,10 @@ ccLanguageType CCApplication::getCurrentLanguage()
|
||||||
{
|
{
|
||||||
ret = kLanguageKorean;
|
ret = kLanguageKorean;
|
||||||
}
|
}
|
||||||
|
else if (0 == strcmp("ja", pLanguageName))
|
||||||
|
{
|
||||||
|
ret = kLanguageJapanese;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,10 +147,14 @@ ccLanguageType CCApplication::getCurrentLanguage()
|
||||||
{
|
{
|
||||||
ret_language = kLanguageRussian;
|
ret_language = kLanguageRussian;
|
||||||
}
|
}
|
||||||
else if (strcmp(language, "ko") == 0)
|
else if (strcmp(language, "ko") == 0)
|
||||||
{
|
{
|
||||||
ret_language = kLanguageKorean;
|
ret_language = kLanguageKorean;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(language, "ja") == 0)
|
||||||
|
{
|
||||||
|
ret_language = kLanguageJapanese;
|
||||||
|
}
|
||||||
|
|
||||||
free(language);
|
free(language);
|
||||||
free(country);
|
free(country);
|
||||||
|
|
|
@ -107,6 +107,9 @@ ccLanguageType CCApplication::getCurrentLanguage()
|
||||||
else if ([languageCode isEqualToString:@"ko"]){
|
else if ([languageCode isEqualToString:@"ko"]){
|
||||||
ret = kLanguageKorean;
|
ret = kLanguageKorean;
|
||||||
}
|
}
|
||||||
|
else if ([languageCode isEqualToString:@"ja"]){
|
||||||
|
ret = kLanguageJapanese;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,8 +100,56 @@ CCApplication* CCApplication::sharedApplication()
|
||||||
|
|
||||||
ccLanguageType CCApplication::getCurrentLanguage()
|
ccLanguageType CCApplication::getCurrentLanguage()
|
||||||
{
|
{
|
||||||
//TODO
|
char *pLanguageName = getenv("LANG");
|
||||||
return kLanguageEnglish;
|
ccLanguageType ret = kLanguageEnglish;
|
||||||
|
if (!pLanguageName)
|
||||||
|
{
|
||||||
|
return kLanguageEnglish;
|
||||||
|
}
|
||||||
|
strtok(pLanguageName, "_");
|
||||||
|
if (!pLanguageName)
|
||||||
|
{
|
||||||
|
return kLanguageEnglish;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == strcmp("zh", pLanguageName))
|
||||||
|
{
|
||||||
|
ret = kLanguageChinese;
|
||||||
|
}
|
||||||
|
else if (0 == strcmp("en", pLanguageName))
|
||||||
|
{
|
||||||
|
ret = kLanguageEnglish;
|
||||||
|
}
|
||||||
|
else if (0 == strcmp("fr", pLanguageName))
|
||||||
|
{
|
||||||
|
ret = kLanguageFrench;
|
||||||
|
}
|
||||||
|
else if (0 == strcmp("it", pLanguageName))
|
||||||
|
{
|
||||||
|
ret = kLanguageItalian;
|
||||||
|
}
|
||||||
|
else if (0 == strcmp("de", pLanguageName))
|
||||||
|
{
|
||||||
|
ret = kLanguageGerman;
|
||||||
|
}
|
||||||
|
else if (0 == strcmp("es", pLanguageName))
|
||||||
|
{
|
||||||
|
ret = kLanguageSpanish;
|
||||||
|
}
|
||||||
|
else if (0 == strcmp("ru", pLanguageName))
|
||||||
|
{
|
||||||
|
ret = kLanguageRussian;
|
||||||
|
}
|
||||||
|
else if (0 == strcmp("ko", pLanguageName))
|
||||||
|
{
|
||||||
|
ret = kLanguageKorean;
|
||||||
|
}
|
||||||
|
else if (0 == strcmp("ja", pLanguageName))
|
||||||
|
{
|
||||||
|
ret = kLanguageJapanese;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -113,6 +113,9 @@ ccLanguageType CCApplication::getCurrentLanguage()
|
||||||
else if ([languageCode isEqualToString:@"ko"]){
|
else if ([languageCode isEqualToString:@"ko"]){
|
||||||
ret = kLanguageKorean;
|
ret = kLanguageKorean;
|
||||||
}
|
}
|
||||||
|
else if ([languageCode isEqualToString:@"ja"]){
|
||||||
|
ret = kLanguageJapanese;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,6 +177,10 @@ ccLanguageType CCApplication::getCurrentLanguage()
|
||||||
currentLanguage = kLanguageKorean;
|
currentLanguage = kLanguageKorean;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case S3E_DEVICE_LANGUAGE_JAPANESE:
|
||||||
|
currentLanguage = kLanguageJapanese;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
currentLanguage = kLanguageEnglish;
|
currentLanguage = kLanguageEnglish;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -139,6 +139,9 @@ ccLanguageType CCApplication::getCurrentLanguage()
|
||||||
case LANG_KOREAN:
|
case LANG_KOREAN:
|
||||||
ret = kLanguageKorean;
|
ret = kLanguageKorean;
|
||||||
break;
|
break;
|
||||||
|
case LANG_JAPANESE:
|
||||||
|
ret = kLanguageJapanese;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -33,9 +33,12 @@ CurrentLanguageTest::CurrentLanguageTest()
|
||||||
case kLanguageSpanish:
|
case kLanguageSpanish:
|
||||||
labelLanguage->setString("current language is Spanish");
|
labelLanguage->setString("current language is Spanish");
|
||||||
break;
|
break;
|
||||||
case kLanguageKorean:
|
case kLanguageKorean:
|
||||||
labelLanguage->setString("current language is Korean");
|
labelLanguage->setString("current language is Korean");
|
||||||
break;
|
break;
|
||||||
|
case kLanguageJapanese:
|
||||||
|
labelLanguage->setString("current language is Japanese");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
addChild(labelLanguage);
|
addChild(labelLanguage);
|
||||||
|
|
|
@ -7,7 +7,9 @@ typedef enum LanguageType
|
||||||
kLanguageItalian,
|
kLanguageItalian,
|
||||||
kLanguageGerman,
|
kLanguageGerman,
|
||||||
kLanguageSpanish,
|
kLanguageSpanish,
|
||||||
kLanguageRussian
|
kLanguageRussian,
|
||||||
|
kLanguageKorean,
|
||||||
|
kLanguageJapanese
|
||||||
} ccLanguageType;
|
} ccLanguageType;
|
||||||
|
|
||||||
enum TargetPlatform
|
enum TargetPlatform
|
||||||
|
|
Loading…
Reference in New Issue