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,
|
kLanguageItalian,
|
||||||
kLanguageGerman,
|
kLanguageGerman,
|
||||||
kLanguageSpanish,
|
kLanguageSpanish,
|
||||||
|
kLanguageRussian
|
||||||
} ccLanguageType;
|
} ccLanguageType;
|
||||||
|
|
||||||
NS_CC_END;
|
NS_CC_END;
|
||||||
|
|
|
@ -105,6 +105,10 @@ ccLanguageType CCApplication::getCurrentLanguage()
|
||||||
{
|
{
|
||||||
ret = kLanguageSpanish;
|
ret = kLanguageSpanish;
|
||||||
}
|
}
|
||||||
|
else if (0 == strcmp("ru", pLanguageName))
|
||||||
|
{
|
||||||
|
ret = kLanguageRussian;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,6 +138,9 @@ ccLanguageType CCApplication::getCurrentLanguage()
|
||||||
else if ([languageCode isEqualToString:@"es"]){
|
else if ([languageCode isEqualToString:@"es"]){
|
||||||
ret = kLanguageSpanish;
|
ret = kLanguageSpanish;
|
||||||
}
|
}
|
||||||
|
else if ([languageCode isEqualToString:@"ru"]){
|
||||||
|
ret = kLanguageRussian;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,22 +127,32 @@ CCApplication& CCApplication::sharedApplication()
|
||||||
|
|
||||||
ccLanguageType CCApplication::getCurrentLanguage()
|
ccLanguageType CCApplication::getCurrentLanguage()
|
||||||
{
|
{
|
||||||
int arrayChineseCode[] = {
|
|
||||||
2052, 4100, 1028, 3076, 5124
|
|
||||||
};
|
|
||||||
|
|
||||||
LCID LanguageID = GetUserDefaultLCID();
|
|
||||||
ccLanguageType ret = kLanguageEnglish;
|
ccLanguageType ret = kLanguageEnglish;
|
||||||
|
|
||||||
int nCount = sizeof(arrayChineseCode) / sizeof(int);
|
LCID localeID = GetUserDefaultLCID();
|
||||||
for (int i = 0; i < nCount; ++i)
|
unsigned short primaryLanguageID = localeID & 0xFF;
|
||||||
{
|
|
||||||
if (arrayChineseCode[i] == LanguageID)
|
switch (primaryLanguageID)
|
||||||
{
|
{
|
||||||
ret = kLanguageChinese;
|
case LANG_CHINESE:
|
||||||
break;
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue