mirror of https://github.com/axmolengine/axmol.git
Merge pull request #545 from moadib/detect_russian_language
More simple and correct way to detect language for win32 application
This commit is contained in:
commit
ea2a428a57
|
@ -62,6 +62,7 @@ typedef enum LanguageType
|
|||
kLanguageItalian,
|
||||
kLanguageGerman,
|
||||
kLanguageSpanish,
|
||||
kLanguageRussian
|
||||
} ccLanguageType;
|
||||
|
||||
NS_CC_END;
|
||||
|
|
|
@ -105,6 +105,10 @@ ccLanguageType CCApplication::getCurrentLanguage()
|
|||
{
|
||||
ret = kLanguageSpanish;
|
||||
}
|
||||
else if (0 == strcmp("ru", pLanguageName))
|
||||
{
|
||||
ret = kLanguageRussian;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -138,6 +138,9 @@ ccLanguageType CCApplication::getCurrentLanguage()
|
|||
else if ([languageCode isEqualToString:@"es"]){
|
||||
ret = kLanguageSpanish;
|
||||
}
|
||||
else if ([languageCode isEqualToString:@"ru"]){
|
||||
ret = kLanguageRussian;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -127,21 +127,31 @@ CCApplication& CCApplication::sharedApplication()
|
|||
|
||||
ccLanguageType CCApplication::getCurrentLanguage()
|
||||
{
|
||||
int arrayChineseCode[] = {
|
||||
2052, 4100, 1028, 3076, 5124
|
||||
};
|
||||
|
||||
LCID LanguageID = GetUserDefaultLCID();
|
||||
ccLanguageType ret = kLanguageEnglish;
|
||||
|
||||
int nCount = sizeof(arrayChineseCode) / sizeof(int);
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
if (arrayChineseCode[i] == LanguageID)
|
||||
LCID localeID = GetUserDefaultLCID();
|
||||
unsigned short primaryLanguageID = localeID & 0xFF;
|
||||
|
||||
switch (primaryLanguageID)
|
||||
{
|
||||
case LANG_CHINESE:
|
||||
ret = kLanguageChinese;
|
||||
break;
|
||||
}
|
||||
case LANG_FRENCH:
|
||||
ret = kLanguageFrench;
|
||||
break;
|
||||
case LANG_ITALIAN:
|
||||
ret = kLanguageItalian;
|
||||
break;
|
||||
case LANG_GERMAN:
|
||||
ret = kLanguageGerman;
|
||||
break;
|
||||
case LANG_SPANISH:
|
||||
ret = kLanguageSpanish;
|
||||
break;
|
||||
case LANG_RUSSIAN:
|
||||
ret = kLanguageRussian;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue