From 1402350870cae5cb175fb57be7c6bf65673525b6 Mon Sep 17 00:00:00 2001 From: Walzer Date: Wed, 31 Aug 2011 14:20:33 +0800 Subject: [PATCH] fixed #676, add more languages into CCApplication::getCurrentLanguage(). Android & iPhone port is done, other platforms no yet. --- cocos2dx/platform/CCCommon.h | 4 ++++ .../platform/android/CCApplication_android.cpp | 18 +++++++++++++++++- cocos2dx/platform/ios/CCApplication_ios.mm | 12 ++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/cocos2dx/platform/CCCommon.h b/cocos2dx/platform/CCCommon.h index 7df46932b2..49638f3b2e 100644 --- a/cocos2dx/platform/CCCommon.h +++ b/cocos2dx/platform/CCCommon.h @@ -58,6 +58,10 @@ typedef enum LanguageType { kLanguageEnglish = 0, kLanguageChinese, + kLanguageFrench, + kLanguageItalian, + kLanguageGerman, + kLanguageSpanish, } ccLanguageType; NS_CC_END; diff --git a/cocos2dx/platform/android/CCApplication_android.cpp b/cocos2dx/platform/android/CCApplication_android.cpp index 2bf15c2aca..a4ae44bb55 100644 --- a/cocos2dx/platform/android/CCApplication_android.cpp +++ b/cocos2dx/platform/android/CCApplication_android.cpp @@ -89,7 +89,23 @@ ccLanguageType CCApplication::getCurrentLanguage() { 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; + } + return ret; } diff --git a/cocos2dx/platform/ios/CCApplication_ios.mm b/cocos2dx/platform/ios/CCApplication_ios.mm index 2931d17fbf..0679f477fd 100644 --- a/cocos2dx/platform/ios/CCApplication_ios.mm +++ b/cocos2dx/platform/ios/CCApplication_ios.mm @@ -126,6 +126,18 @@ ccLanguageType CCApplication::getCurrentLanguage() { ret = kLanguageEnglish; } + else if ([languageCode isEqualToString:@"fr"]){ + ret = kLanguageFrench; + } + else if ([languageCode isEqualToString:@"it"]){ + ret = kLanguageItalian; + } + else if ([languageCode isEqualToString:@"de"]){ + ret = kLanguageGerman; + } + else if ([languageCode isEqualToString:@"es"]){ + ret = kLanguageSpanish; + } return ret; }