Niedzielski has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316495

Change subject: Use Chinese script when available, not country
......................................................................

Use Chinese script when available, not country

Determine Chinese variant by script on newer APIs.

Change-Id: I2b759fb4cc512a8441c98d4a8f04fee7db12d954
---
M app/src/main/java/org/wikipedia/language/LanguageUtil.java
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/95/316495/1

diff --git a/app/src/main/java/org/wikipedia/language/LanguageUtil.java 
b/app/src/main/java/org/wikipedia/language/LanguageUtil.java
index 10e1fce..e9e9e23 100644
--- a/app/src/main/java/org/wikipedia/language/LanguageUtil.java
+++ b/app/src/main/java/org/wikipedia/language/LanguageUtil.java
@@ -1,5 +1,6 @@
 package org.wikipedia.language;
 
+import android.os.Build;
 import android.support.annotation.Nullable;
 
 import java.util.Arrays;
@@ -29,6 +30,13 @@
             case "ji":
                 return "yi"; // Yiddish
             case "zh":
+                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                    String script = Locale.getDefault().getScript();
+                    return "Hant".equals(script)
+                            ? 
AppLanguageLookUpTable.TRADITIONAL_CHINESE_LANGUAGE_CODE
+                            : 
AppLanguageLookUpTable.SIMPLIFIED_CHINESE_LANGUAGE_CODE;
+                }
+
                 // If the user configures Android for Chinese (zh) we have no 
way to know the intended
                 // dialect. We guess based on country. If the guess is 
incorrect, the user must explicitly
                 // choose the dialect in the app settings.

-- 
To view, visit https://gerrit.wikimedia.org/r/316495
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b759fb4cc512a8441c98d4a8f04fee7db12d954
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to