mdn / yari

The platform code behind MDN Web Docs
Mozilla Public License 2.0
1.16k stars 485 forks source link

The platform doesn't seem to remember my language preference #2724

Open asterix123 opened 3 years ago

asterix123 commented 3 years ago

I live in Ukraine and a while ago Google started to 'promote' search results in Russian language over search results in English. Even when you search in English :) So whenever I come to MDN from Google, I almost always see a page in Russian, instead of seeing the page in English (as expected).

Therefore, I was wondering if it would be possible to save language preference in my profile and be redirected to English version of the page, even when I visit MDN links containing /ru/ in the URL?

peterbe commented 3 years ago

Excellent question! And you're not the first one to bring it up. There are some browser extensions that you might be able to use. But MDN is a static site so it's a bit hard to do the redirecting. Another challenge is that we still have URLs that are different from the English URL (so it wouldn't simply be a matter of swapping from /ru/ to /en-US/). But we're working actively on that (hi @fiji-flo ) so it can become easier in a couple of weeks.

One option we could do is that if you do stumble into a page whose locale is different from your cookie, a little banner appears. And in that banner there's a link to the English URL and an option/button that enables it to auto-redirect next time.

asterix123 commented 3 years ago

@peterbe Thank you for a detailed reply. Yes, a banner could be a nice solution.

peterbe commented 3 years ago

I think we should keep it open. That way it helps us remember how many people are asking about this.

ghost commented 3 years ago

Does It help? https://blog.mozilla.org/l10n/2019/04/02/changing-the-language-of-firefox-directly-from-the-browser/

peterbe commented 3 years ago

Does It help? https://blog.mozilla.org/l10n/2019/04/02/changing-the-language-of-firefox-directly-from-the-browser/

The problem is that we have the locale hardcoded in the URL. That gets indexed by Google and Google presents those links. MDN does neat things with the browser's request (cookies and/or Accept-Language header) but only if the locale isn't already in the URL.

schalkneethling commented 3 years ago

@peterbe will this be addressed by the new settings page?

escattone commented 3 years ago

@schalkneethling No, that still uses the preferredlocale cookie, which is only respected for URL's without a locale, but we've added this feature request to our 2021 backlog.

schalkneethling commented 3 years ago

@schalkneethling No, that still uses the preferredlocale cookie, which is only respected for URL's without a locale, but we've added this feature request to our 2021 backlog.

Aha, gotcha! Now I understand that better as well. Thanks, Ryan