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