Merge pull request #1784 from knoxHuang/v2.1.3

improve getCurrentLanguage to android
This commit is contained in:
Jare Guo
2019-07-29 11:32:05 +08:00
committed by GitHub
4 changed files with 12 additions and 3 deletions
@@ -128,8 +128,7 @@ void Application::setPreferredFramesPerSecond(int fps)
std::string Application::getCurrentLanguageCode() const
{
std::string language = getCurrentLanguageJNI();
return language;
return getCurrentLanguageCodeJNI();
}
bool Application::isDisplayStats() {
@@ -305,7 +305,11 @@ public class Cocos2dxHelper {
public static String getCurrentLanguage() {
return Locale.getDefault().getLanguage();
}
public static String getCurrentLanguageCode() {
return Locale.getDefault().toString();
}
public static String getDeviceModel(){
return Build.MODEL;
}
@@ -599,6 +599,11 @@ std::string getCurrentLanguageJNI()
return JniHelper::callStaticStringMethod(JCLS_HELPER, "getCurrentLanguage");
}
std::string getCurrentLanguageCodeJNI()
{
return JniHelper::callStaticStringMethod(JCLS_HELPER, "getCurrentLanguageCode");
}
std::string getSystemVersionJNI()
{
return JniHelper::callStaticStringMethod(JCLS_HELPER, "getSystemVersion");
@@ -42,6 +42,7 @@ extern int getDeviceSampleRateJNI();
extern int getDeviceAudioBufferSizeInFramesJNI();
extern std::string getCurrentLanguageJNI();
extern std::string getCurrentLanguageCodeJNI();
extern std::string getSystemVersionJNI();
extern bool openURLJNI(const std::string& url);
extern void copyTextToClipboardJNI(const std::string& text);