Page MenuHomePhabricator

[Bug] Showing incorrect language variant in Chinese article
Closed, ResolvedPublicBUG REPORT

Description

How many times were you able to reproduce it?

Every time

Steps to reproduce

  1. Open Barack_Obama article in Chinese
  2. Observe the first paragraph of the article.

Expected results

In zh-hant, it should be shown as:

巴拉克·歐巴馬(英語:Barack Obama,1961年8月4日-),全名巴拉克·海珊·歐巴馬二世(英語:Barack Hussein Obama II,美國 聆聽i/bəˈrɑːk huːˈseɪn oʊˈbɑːmə/),是美國政治人物,從2009年至2017年任第44任美國總統。他是首位擁有非裔血統的美國總統。2005年至2008年代表伊利諾州擔任美國聯邦參議員,從1997年至2004年擔任伊利諾州參議員時居於芝加哥。卸任總統後,定居首都華盛頓特區。

In zh-hans:

巴拉克·奥巴马(英语:Barack Obama,1961年8月4日-),全名巴拉克·侯赛因·奥巴马二世(英语:Barack Hussein Obama II,美国 聆听i/bəˈrɑːk huːˈseɪn oʊˈbɑːmə/),是美国政治人物,从2009年至2017年任第44任美国总统。他是首位拥有非裔血统的美国总统。2005年至2008年代表伊利诺伊州担任美国联邦参议员,从1997年至2004年担任伊利诺伊州参议员时居于芝加哥。卸任总统后,定居首都华盛顿特区。

Actual results

Content with mixed language variants.

巴拉克·奥巴马(英語:Barack Obama,1961年8月4日-),全名巴拉克·侯赛因·奥巴马二世(英語:Barack Hussein Obama II,美國 聆聽i/bəˈrɑːk huːˈseɪn oʊˈbɑːmə/),是美國政治人物,从2009年至2017年任第44任美國總統。他是首位擁有非裔血統的美国总统。2005年至2008年代表伊利诺伊州担任美國聯邦參議員,从1997年至2004年担任伊利诺伊州参议员時居於芝加哥。卸任總統後,定居首都华盛頓特區。

Screenshots


You can observe the difference in the red rectangles.

Note:
Looks like the app does not send correct language code to the mobile-html. The issue happens when sending only zh language code. My suggestion would be sending the zh-hant as default if the app does not support switching Chinese language variants in the app.

Please note that the table of content also does not have the correct language variant.

Event Timeline

cooltey created this task.Jun 5 2020, 8:30 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 5 2020, 8:30 PM
Shizhao moved this task from Backlog to Extensions on the Chinese-Sites board.

@cooltey what languages do you have set and in what order in the iOS Settings app > General > Language & Region?

@JoeWalsh, here's the screenshot of the language setting and I remember that the previous version of the Wikipedia app does not have this issue.

I've tested it with and without logging in my account and can reproduce it in both scenarios.

Change 606013 had a related patch set uploaded (by Joewalsh; owner: Joewalsh):
[mediawiki/services/mobileapps@master] Only pass the first relevant language code along to action=mobileview

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

Change 606013 merged by Joewalsh:
[mediawiki/services/mobileapps@master] Only pass the first relevant language code along to action=mobileview

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

bearND added a subscriber: bearND.Jun 24 2020, 10:07 PM

Changed has been deployed. Please test with the native apps.

Still seeing the issue. I have set my iPad's primary language in Traditional Chinese.

The title should be looked like below:

bearND added a subscriber: Pchelolo.

It works when hitting mobileapps directly[1] but RESTBase[2] doesn't forward the accept-language header to it when requesting mobile-html. This doesn't even work with the summary endpoint through RB, it seems[3], but it does with mobile-sections-lead[4].

I set my browser to Traditional Chinese:
[1] http://localhost:8888/zh.wikipedia.org/v1/page/mobile-html/%E8%B4%9D%E6%8B%89%E5%85%8B%C2%B7%E5%A5%A5%E5%B7%B4%E9%A9%AC
shows 巴拉克·歐巴馬 (ok, i think)
[2] http://localhost:7233/zh.wikipedia.org/v1/page/mobile-html/%E8%B4%9D%E6%8B%89%E5%85%8B%C2%B7%E5%A5%A5%E5%B7%B4%E9%A9%AC
shows 巴拉克·奥巴马 (i know the last character is wrong) (Ignore the CSP issues there when running locally for now. It's enough to see the first section.)
[3] http://localhost:7233/zh.wikipedia.org/v1/page/summary/%E8%B4%9D%E6%8B%89%E5%85%8B%C2%B7%E5%A5%A5%E5%B7%B4%E9%A9%AC shows "displaytitle": "贝拉克·奥巴马", (i know the last character is wrong)
[4] http://localhost:7233/zh.wikipedia.org/v1/page/mobile-sections-lead/%E8%B4%9D%E6%8B%89%E5%85%8B%C2%B7%E5%A5%A5%E5%B7%B4%E9%A9%AC shows "displaytitle": "巴拉克·歐巴馬" (ok, i think)

@Pchelolo Is there anything special about Chinese language variant handling that makes it work for mobile-sections* but not for mobile-html and summary?

JoeWalsh added a comment.EditedJun 26 2020, 12:59 PM

@Pchelolo It looks like the requests work when Accept-Language contains a single language with a Wikipedia language code. For example Accept-Language: en, zh-tw;q=0.5 doesn't work but Accept-Language: zh-tw does. The former is what the app sends currently and is the format described by ietf. The mobileapps service has logic to take the standard header and translate it to the relevant wikipedia language codes for the given request. For example, a request with Accept-Language: en, sr-Latn;q=0.9, sr-Cyrl;q=0.8 to sr.wikipedia.org is normalized to sr-el. We'd be OK with the whole header being passed on to the mobileapps service so that logic handles the request. However, if the header needs to be normalized before it gets to the mobileapps service, could that logic be used upstream?

In RESTBase we want to know if the language has variants for efficiency reasons, so the code from mobile apps should probably be upstreamed to RESTBase. Currently it's understanding of accept-language header is very basic.

JoeWalsh added a comment.EditedJun 26 2020, 3:37 PM

In RESTBase we want to know if the language has variants for efficiency reasons, so the code from mobile apps should probably be upstreamed to RESTBase. Currently it's understanding of accept-language header is very basic.

I filed T256491 to capture this change. I thought this was working before - did RESTBase previously pass the entire Accept-Language header onto mobileapps?

I thought this was working before - did RESTBase previously pass the entire Accept-Language header onto mobileapps?

Nothing changed in that area as far as I know.. Strange.

Shizhao moved this task from Extensions to Apps on the Chinese-Sites board.Jul 6 2020, 1:06 AM
eprodromou added a subscriber: eprodromou.

Since we captured the issues for RESTBase in T256491, I'm going to untag our team.

MSantos closed this task as Resolved.Wed, Jul 8, 12:00 PM
MSantos added a subscriber: MSantos.

Closing this as resolved since the PCS part is done and the remaining work will be tracked at T256491: Improve Accept-Language header handling in RESTBase

Shizhao moved this task from Apps to Closed on the Chinese-Sites board.Thu, Jul 9, 1:28 AM