-
Notifications
You must be signed in to change notification settings - Fork 923
[Bug report] lang on the 404 page is not set and defaults the Locale to "en" #1365
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
Comments
The solution may break ssr as there is no window during ssr, and it can cause an ssr mismatch. Have you tested your "Potential fix"? |
I have not tested this fix with an ssr project. In the browser it does return the correct locale. Perhaps this project could shed some light on what is needed: https://vueuse.org/core/useNavigatorLanguage/ |
bump, any updates? |
I think the page lang should clarify the language of the page content, instead of the browser settings. |
The main problem is the static default and no way to configure it. The proposed solution still prefers the page set but also looks at the browser. Another option would be for a configurable fallback vs a static one.
The best option is for the 404 and all pages generated by vuepress to respect the lang setting. The notFound setting doesn't look to allow for multiple languages. Is that intentional? |
Does anyone know if there is a workaround as this is actively making our search not work from the 404 page since everything is indexed against |
@vordimous Have you tried to create a |
@meteorlxy I tried to create the |
bump |
This is an actual problem, see https://theme-hope.vuejs.press/zh/a and https://theme-hope.vuejs.press/a I think we should respect locale setting, as you can see that those pages are rendering exactly as locale settings. A valid PR is always welcome, I am busy these days. |
@Mister-Hope I dug a little deeper and found a good solution. It turns out the problem is just in the computed resolver so there is much less of an impact. Here is my PR |
Description
The 404 page is not getting normal page variables sent to it. This means the locale in js defaults to "en" when none is present.
This is causing js plugins like algolia search to get the wrong lang value. Which should be "en-US" instead of "en".
Code issue:
Potential fix:
Reproduction
the base example v2.vuepress.vuejs.org/new shows the error when checking the value of 'document.documentElement.lang' from the home page and 404 page.
Used Package Manager
pnpm
System Info
The text was updated successfully, but these errors were encountered: