implemented CCApplication::getCurrentLanguage() for linux platform

This commit is contained in:
Taro Kobayashi 2012-11-28 19:41:50 +09:00
parent 472ce4f9f3
commit 3a814de07e
1 changed files with 50 additions and 2 deletions

View File

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