Page MenuHomePhabricator

Wrong accept language list for anonymous users in Wikimedia
Closed, ResolvedPublic

Description

When this text was written, visiting http://en.wikipedia.beta.wmflabs.org/wiki/Europe in incognito mode (logged out) returns wrong accept languages:

mw.config.get( 'wgULSAcceptLanguageList' ) 
["ru", "uk", "be", "en", "*"]

For the record my accept language header is:

Accept-Language:fi,en-US;q=0.8,en;q=0.6

My theory is that this is because anonymous page views are cached at Wikimedia.

We should stop outputting wgULSAcceptLanguageList for anonymous users if language selection is not enabled for anonymous users.

There is no way we can get this data always for anonymous users for compact language links in the sidebar. We can get that list by doing an additional request that is not cached: for that we should probably create a new API module in ULS or core. We could also store this data on localstorage or cookies (to share between sites) for some time to use it for the future requests.

Event Timeline

Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJun 10 2016, 7:56 AM

Change 293686 had a related patch set uploaded (by Nikerabbit):
Do not output accept language list if it might get cached

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

There is no way we can get this data always for anonymous users for compact language links in the sidebar.

We can read the accept-language at client side now( I blogged about this in 2014 -
http://thottingal.in/blog/2014/05/17/navigator-languages-is-coming/ )

navigator.languages will give this at client side(just verified this in Chrome 51 and FF 47).

santhosh moved this task from Backlog to In Progress on the Language-Q4-2016-Sprint 4 board.
santhosh triaged this task as Normal priority.

Change 293686 merged by jenkins-bot:
Do not output accept language list if it might get cached

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

Change 294243 had a related patch set uploaded (by Santhosh):
Use navigator.languages as fallback for mw.uls.getAcceptLanguageList

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

Change 294243 merged by jenkins-bot:
Use navigator.languages as fallback for mw.uls.getAcceptLanguageList

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

Arrbee moved this task from QA to Done on the Language-Q4-2016-Sprint 4 board.Jun 14 2016, 7:01 AM
Nikerabbit closed this task as Resolved.Jun 17 2016, 8:35 AM

Verified on http://en.wikipedia.beta.wmflabs.org/wiki/Europe (after purging I get null) and https//en.wikipedia.org/wiki/Helsinki (null) in incognito mode.

Also mw.uls.getAcceptLanguageList() returns languages from my browser as fallback now.

Amire80 moved this task from Backlog to Other on the ULS-CompactLinks board.Nov 3 2017, 8:25 AM