Brion VIBBER has uploaded a new change for review.

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

Change subject: WIP testing hack: send Accept-Language with API requests
......................................................................

WIP testing hack: send Accept-Language with API requests

Hardcodes an Accept-Language for 'zh-hant' (Traditional Chinese);
loading up the Chinese Wikipedia main page with this header on
shows a bunch of chars converted to Traditional which show as
Simplified Chinese if you don't use it.

We could also send the 'variant' URL or POST parameter.

For proper variant fix, we need to send either Accept-Language or
the variant param, using the appropriate locale.

As a temporary hack we can try using the system locale here, which
should select the right output format if the user has their phone
configured to either Traditional or Simplified Chinese... A better
solution may be to have separate zh-* variants appear as individual
language entries in the selection, so folks can override their phone
locale, or pick their preferred variant even if the phone is set to
another language like English.

Change-Id: I0265446051f817a6e8f27ca03e2757e9a8163baa
---
M wikipedia/src/main/java/org/wikipedia/WikipediaApp.java
1 file changed, 4 insertions(+), 1 deletion(-)


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

diff --git a/wikipedia/src/main/java/org/wikipedia/WikipediaApp.java 
b/wikipedia/src/main/java/org/wikipedia/WikipediaApp.java
index afa58ca..fe8ef7e 100644
--- a/wikipedia/src/main/java/org/wikipedia/WikipediaApp.java
+++ b/wikipedia/src/main/java/org/wikipedia/WikipediaApp.java
@@ -167,7 +167,10 @@
         String domainAndApiDomainKey = site.getDomain() + "-" + 
site.getApiDomain();
 
         if (!apis.containsKey(domainAndApiDomainKey))  {
-            apis.put(domainAndApiDomainKey, new Api(site.getApiDomain(), 
getUserAgent()));
+            // Testing hack: send Accept-Language header requesting 
Traditional Chinese
+            HashMap<String,String> customHeaders = new 
HashMap<String,String>();
+            customHeaders.put("Accept-Language", "zh-hant;q=0.9");
+            apis.put(domainAndApiDomainKey, new Api(site.getApiDomain(), 
getUserAgent(), customHeaders));
         }
         return apis.get(domainAndApiDomainKey);
     }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0265446051f817a6e8f27ca03e2757e9a8163baa
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER <br...@wikimedia.org>

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

Reply via email to