Skip to content
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

[docs] Fix language cookie #23324

Merged
merged 3 commits into from Oct 31, 2020
Merged

Conversation

mbrookes
Copy link
Member

This seems to solve the problem of not respecting a visitor's docs language setting on subsequent visits. There's another issue with the browser constantly reloading a 404 page when the browser language is set, but I haven't tried to resolve that here.

@mbrookes mbrookes added the docs Improvements or additions to the documentation label Oct 30, 2020
window.location = preferedLanguage === 'en' ? canonical : `/${preferedLanguage}${canonical}`;
} else if (userLanguageUrl !== userLanguage) {
} else if (userLanguage !== userLanguageUrl) {
dispatch({ type: ACTION_TYPES.OPTIONS_CHANGE, payload: { userLanguage: userLanguageUrl } });
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never actually seem to reach this branch, but then not sure where userLanguage is set otherwise?

@mui-pr-bot
Copy link

mui-pr-bot commented Oct 30, 2020

No bundle size changes

Generated by 🚫 dangerJS against 3fddd80

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the redirection should only work when loading the naked folder, not when visiting a translated version

docs/pages/_app.js Outdated Show resolved Hide resolved
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@oliviertassinari oliviertassinari merged commit 0b2ec9a into mui:next Oct 31, 2020
@mbrookes mbrookes deleted the docs-use-userLanguage branch October 31, 2020 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants