mirror of https://github.com/axmolengine/axmol.git
implemented CCApplication::getCurrentLanguage() for linux platform
This commit is contained in:
parent
472ce4f9f3
commit
3a814de07e
|
@ -100,8 +100,56 @@ CCApplication* CCApplication::sharedApplication()
|
|||
|
||||
ccLanguageType CCApplication::getCurrentLanguage()
|
||||
{
|
||||
//TODO
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue