Merge pull request #1725 from minggo/merge_jp_support

Merge jp support
This commit is contained in:
minggo 2012-12-04 22:11:42 -08:00
commit c3a5e870af
10 changed files with 81 additions and 6 deletions

View File

@ -64,7 +64,8 @@ typedef enum LanguageType
kLanguageGerman,
kLanguageSpanish,
kLanguageRussian,
kLanguageKorean
kLanguageKorean,
kLanguageJapanese
} ccLanguageType;
// end of platform group

View File

@ -112,6 +112,10 @@ ccLanguageType CCApplication::getCurrentLanguage()
{
ret = kLanguageKorean;
}
else if (0 == strcmp("ja", pLanguageName))
{
ret = kLanguageJapanese;
}
return ret;
}

View File

@ -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);

View File

@ -107,6 +107,9 @@ ccLanguageType CCApplication::getCurrentLanguage()
else if ([languageCode isEqualToString:@"ko"]){
ret = kLanguageKorean;
}
else if ([languageCode isEqualToString:@"ja"]){
ret = kLanguageJapanese;
}
return ret;
}

View File

@ -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

View File

@ -113,6 +113,9 @@ ccLanguageType CCApplication::getCurrentLanguage()
else if ([languageCode isEqualToString:@"ko"]){
ret = kLanguageKorean;
}
else if ([languageCode isEqualToString:@"ja"]){
ret = kLanguageJapanese;
}
return ret;
}

View File

@ -177,6 +177,10 @@ ccLanguageType CCApplication::getCurrentLanguage()
currentLanguage = kLanguageKorean;
break;
case S3E_DEVICE_LANGUAGE_JAPANESE:
currentLanguage = kLanguageJapanese;
break;
default:
currentLanguage = kLanguageEnglish;
break;

View File

@ -139,6 +139,9 @@ ccLanguageType CCApplication::getCurrentLanguage()
case LANG_KOREAN:
ret = kLanguageKorean;
break;
case LANG_JAPANESE:
ret = kLanguageJapanese;
break;
}
return ret;

View File

@ -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);

View File

@ -7,7 +7,9 @@ typedef enum LanguageType
kLanguageItalian,
kLanguageGerman,
kLanguageSpanish,
kLanguageRussian
kLanguageRussian,
kLanguageKorean,
kLanguageJapanese
} ccLanguageType;
enum TargetPlatform