You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@weex.apache.org by GitBox <gi...@apache.org> on 2018/09/20 06:40:30 UTC

[GitHub] YorkShen closed pull request #1547: * [android] Fix getLanguage

YorkShen closed pull request #1547: * [android] Fix getLanguage
URL: https://github.com/apache/incubator-weex/pull/1547
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/android/sdk/libs/armeabi-v7a/libweexcore.so b/android/sdk/libs/armeabi-v7a/libweexcore.so
index 5a99801276..dc233b8ffa 100644
Binary files a/android/sdk/libs/armeabi-v7a/libweexcore.so and b/android/sdk/libs/armeabi-v7a/libweexcore.so differ
diff --git a/android/sdk/libs/armeabi/libweexcore.so b/android/sdk/libs/armeabi/libweexcore.so
index 2933571d03..afcf2e0adc 100644
Binary files a/android/sdk/libs/armeabi/libweexcore.so and b/android/sdk/libs/armeabi/libweexcore.so differ
diff --git a/android/sdk/libs/x86/libweexcore.so b/android/sdk/libs/x86/libweexcore.so
new file mode 100644
index 0000000000..99de85a55d
Binary files /dev/null and b/android/sdk/libs/x86/libweexcore.so differ
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/module/WXLocaleModule.java b/android/sdk/src/main/java/com/taobao/weex/ui/module/WXLocaleModule.java
index 6a3de81196..41a0c55104 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/module/WXLocaleModule.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/module/WXLocaleModule.java
@@ -43,13 +43,23 @@
 public class WXLocaleModule extends WXModule {
 
   @JSMethod(uiThread = false)
-  public String getLanguage() {
-    return getLanguageTags();
+  public String getLanguageSync() {
+    return getLanguageImpl();
   }
 
   @JSMethod(uiThread = false)
   public void getLanguage(JSCallback callback) {
-    callback.invoke(getLanguageTags());
+    callback.invoke(getLanguageImpl());
+  }
+
+  private String getLanguageImpl() {
+    Locale locale;
+    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+      locale = LocaleList.getDefault().get(0);
+    } else locale = Locale.getDefault();
+
+    String language = locale.getLanguage() + "-" + locale.getCountry();
+    return language;
   }
 
   @JSMethod(uiThread = false)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services