Page MenuHomePhabricator

Portal ignores Accept-Language header, content always in English language
Closed, InvalidPublic

Description

I'd expect https://www.wikipedia.org/ to check the Accept-Language request HTTP header sent by my web browser. That's also implied by T159596.

In practice, though I sent stuff like Accept-Language: fa-IR,cs-CZ;q=0.90,fa;q=0.80,cs;q=0.70, text like "Read Wikipedia in your language" and the links to sister projects at the bottom remained English, though translations for that text exist in the file l10n/fa.json (e.g. "language-button-text": "ویکی‌پدیا را به زبان خود بخوانید"). Tried this with two browsers.

T275597.png (1,920×1,053 px, 253 KB)

Event Timeline

@Aklapper The reason this doesn't work as you would expect, is that the www.wikipedia.org portal actually has no server-side component.

The translations are actually all done client-side, in the browser.

To achieve this, we depend on the browser preferences to pick the right languages. Those preferences usually change the Accept-Language header, but just sending a request with modified headers doesn't change the browser preferences, which is why such a request doesn't translate the page.

This is a limitation of the technical setup. It would certainly be more performant to do the translations server-side, and there are various experimental ideas for how that could be achieved, but for now it's just one version of a static HTML/CSS/JS page sent to everyone, and then updated with different translations as needed.

@Jdrewniak: Not sure I understand correctly... I did not manually modify HTTP headers; I changed the content language preference settings in two of my web browsers and after that went to www.wikipedia.org, and stuff on that website was still in English. My question is basically: How to ever see the translation strings which exist in Git also on the web site, instead of the website displaying everything in English?

hmm, that is odd. These are what my browser language preferences look like in Chrome:

Screen Shot 2021-02-24 at 12.39.39 PM.png (1,984×1,224 px, 208 KB)

and this is what I see when I go to www.wikipedia.org

Screen Shot 2021-02-24 at 12.39.54 PM.png (2,162×1,978 px, 953 KB)

Let me know what your browser and settings look like and I'll see if I can replicate.

hmm, that is odd. These are what my browser language preferences look like in Chrome:

Screen Shot 2021-02-24 at 12.39.39 PM.png (1,984×1,224 px, 208 KB)

and this is what I see when I go to www.wikipedia.org

Screen Shot 2021-02-24 at 12.39.54 PM.png (2,162×1,978 px, 953 KB)

Let me know what your browser and settings look like and I'll see if I can replicate.

This language change perference worked for me..I was able to change the browser language and observe this issue T262783 .
I want to know exactly which function is responsible for the taking the browser prefered language and converting it in to browser prefered language.
and how this whole language conversion is working so that i can work in this issue further.

Aklapper closed this task as Invalid.EditedFeb 24 2021, 1:44 PM

Jan: This task is invalid, sorry for making you spend time here. :( I'll report a bug to the browser developers. (I am...puzzled. It works on Firefox 85.0 on Fedora 34 with no add-ons; it now suddenly also works with Firefox 85.0 on Fedora 33 with some add-ons; it still does not work in Epiphany 3.38.2 and 40~beta-1.)