Experiment: Remember language 🧪 #739
Replies: 10 comments 2 replies
-
This is an amazing experiment, I'd love to hear how it ends up helping folks read better on MDN! 📚 |
Beta Was this translation helpful? Give feedback.
-
I have just found this page from the "?" icon next to the feature. I just wanted to sing a few words of praise. A bit of feedback:
So what is my intent? It depends on the task:
A pet peeve of mine is clicking on an English result and seeing the German version, then having to scroll all the way to the bottom of the page to change the language. A bit later, I click another English result and the same thing happens again. I find your approach very elegant, and accommodating to all user intents. Very well done! |
Beta Was this translation helpful? Give feedback.
-
I was wondering why my automatic redirection to English was acting weird, turns out I don't need it anymore! Thank you for this QoL experiment! |
Beta Was this translation helpful? Give feedback.
This comment was marked as spam.
This comment was marked as spam.
-
OMG YOU ARE A SAVIOUR. For years I had to manually change the langague to english, because MDN translations are inconsistent (they generally have less content that the page in english and some layouts are broken). |
Beta Was this translation helpful? Give feedback.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
-
Hi! Some weird behaviour regarding language redirections: If a MDN url is shared with NO language slug (without the /en-US/ or any other language part), it will redirect to the 'remember language' locale version of that page regardless if that translation exists or not. Example:
In this scenario:
Maybe this extra click to get to the English fallback page is the intended way to work. But it's a bit weird given that MDN asks to always use this non-localized format in the "mdn_url" field of several repos and services like BCD. One idea: all these non-localized urls could always be redirected to the /en-US/ version in the first place; then, if the user has set a preferred language, check if that page has a locale version. If the translation exists, redirect, and if not, stays on the English page. Not sure if this is a good idea as it could generate a lot of redirects. Another option would be to change all those mdn_urls to their /en-US/ version in the origin, but I guess that would also involve other complex things beyond my experience. And having that extra click is not a big deal for the user, really. Anyway, I came upon all these links and just wanted to point that out. Regards! |
Beta Was this translation helpful? Give feedback.
-
tl;dr
We launched an experimental MDN feature on September 25, 2024 that allows users to choose their preferred language and automatically switch to this language when the requested content is available in that language.
Background
MDN is currently available in English (en-US) and 8 other translated languages (es, fr, ja, ko, pt-BR, ru, zh-CN, zh-TW) and users have always been able to switch to their preferred language manually using the language menu.
Problem
There have been two outstanding issues:
Solution
We have introduced a "Remember language" setting in the language menu. Enabling the setting saves the current language in the
preferredlocale
cookie, and this will prompt MDN to redirect users whenever they navigate to a page that is available in that language. Disabling the setting will delete the cookie, and users will no longer be redirected.Note: The cookie has been previously used to save the last language that the user switched to. For this reason, the setting is enabled for all users that have recently switched the language on MDN.
Use case 1: Preference for English
Charlie lives in France and uses French Google, but prefers to read MDN in English, so they enabled "Remember language" while browsing MDN in English.
preferredlocale=en-US
cookie, they now get redirected to English:Use case 2: Preference for translated language
Jin lives in South Korea and has basic English knowledge, but prefers to read MDN in Korean, their native language, so they enabled "Remember language" while browsing MDN in Korean.
intersection()
link.preferredlocale=ko
cookie and the page is available in Korean, they now get redirected to:Beta Was this translation helpful? Give feedback.
All reactions