diff --git a/cocos2dx/platform/CCCommon.h b/cocos2dx/platform/CCCommon.h index 49638f3b2e..6a60672af2 100644 --- a/cocos2dx/platform/CCCommon.h +++ b/cocos2dx/platform/CCCommon.h @@ -62,6 +62,7 @@ typedef enum LanguageType kLanguageItalian, kLanguageGerman, kLanguageSpanish, + kLanguageRussian } ccLanguageType; NS_CC_END; diff --git a/cocos2dx/platform/android/CCApplication_android.cpp b/cocos2dx/platform/android/CCApplication_android.cpp index a4ae44bb55..8c6c587da8 100644 --- a/cocos2dx/platform/android/CCApplication_android.cpp +++ b/cocos2dx/platform/android/CCApplication_android.cpp @@ -105,6 +105,10 @@ ccLanguageType CCApplication::getCurrentLanguage() { ret = kLanguageSpanish; } + else if (0 == strcmp("ru", pLanguageName)) + { + ret = kLanguageRussian; + } return ret; } diff --git a/cocos2dx/platform/ios/CCApplication_ios.mm b/cocos2dx/platform/ios/CCApplication_ios.mm index 0679f477fd..b2fefa67ba 100644 --- a/cocos2dx/platform/ios/CCApplication_ios.mm +++ b/cocos2dx/platform/ios/CCApplication_ios.mm @@ -138,6 +138,9 @@ ccLanguageType CCApplication::getCurrentLanguage() else if ([languageCode isEqualToString:@"es"]){ ret = kLanguageSpanish; } + else if ([languageCode isEqualToString:@"ru"]){ + ret = kLanguageRussian; + } return ret; } diff --git a/cocos2dx/platform/win32/CCApplication_win32.cpp b/cocos2dx/platform/win32/CCApplication_win32.cpp index 8333c8d19b..47e4910b93 100644 --- a/cocos2dx/platform/win32/CCApplication_win32.cpp +++ b/cocos2dx/platform/win32/CCApplication_win32.cpp @@ -127,22 +127,32 @@ 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) - { - ret = kLanguageChinese; - break; - } - } + 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; }