-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Force locale redirects #275
Comments
It would be much more convenient to ask the user, after they changed locale, "Do you prefer this language?" and if they say yes, put a thing into class App extends Component {
componentDidMount() {
var preferred = localStorage.getItem('preferred-locale')
var current = this.getCurrentLocale()
if (preferred && preferred !== current) {
this.startReactRouterRedirectTo(preferred).then(() => {
// alternatively use sessionStorage depend on how we do or don't use client-side navigation
this.setState({redirectedFrom: current})
})
}
}
} This way we keep our server code much simpler and users won't have to register and sign in and besides a check like this doesn't require network, unlike a |
Typical example: mdn/kuma#6166 |
@escattone Would it be at all feasible to make our Lambda@Edge depend on a cookie? I know (with 90% certainty) that technically it's possible to have CloudFront take the cookie into account. But it might get messy. We could implement something fairly easily, in the client code. If you arrive on a non-en-US page, you have access to At this point, it's more of a "product" decision rather than a matter of regular Yari redirect problems. |
A lot of people prefer a different locale (of en-US) than the one they click on. One very common example is a non-English user, who lives in France for example, who googles for something and since Google prefers localized content she's presented with a link to
https://developer.mozilla.org/fr/docs/Apprendre/Commencer_avec_le_web
which she clicks. Upon arrival, she realizes she prefers the English version so she has to click the language switcher to go over tohttps://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web
She could have installed MDN Language Redirector but that's a pain.
The text was updated successfully, but these errors were encountered: