vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
11.48k stars 1.86k forks source link

header and footer of 404 page are not localized #3056

Closed neicore closed 1 week ago

neicore commented 7 months ago

Describe the bug

I added a custom notFound and footer content in the themeConfig and it works as expected, but when I passed custom in themeConfig of a locale, the values didn't appear

Reproduction

In any vitepress project that has locale go to themeConfig of that locale and add custom notFound or footer values and they wont show up when you are in that locale

Expected behavior

When you add custom values of notFound or footer in themeConfig or a locale, they should show up if you are in that locale

System Info

System:
    OS: Linux 6.1 Manjaro Linux
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 5.70 GB / 15.31 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.5.0 - ~/.nvm/versions/node/v20.5.0/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 9.8.0 - ~/.nvm/versions/node/v20.5.0/bin/npm
  npmPackages:
    vitepress: ^1.0.0-rc.20 => 1.0.0-rc.20

Additional context

you can find my config here: https://github.com/NuruProgramming/nyaraka/blob/main/docs/.vitepress/config.mts

currently it only has notFound property in locale

Validations

narumi147 commented 6 months ago

same here, should be fixed before stable release!

narumi147 commented 6 months ago

Also there are several l18n related:

dragomano commented 5 months ago

Tooltip for the "Copy Code" button is hardcoded too.

NozomuIkuta commented 2 weeks ago

@brc-dd

I faced at this issue with the latest VitePress.

As far as I investigated, what's happening is like below:

Updating notFoundPageData.relativePath based on the current route would resolve this issue, but I'm not sure might be missing a reason why you set an empty string to it, and can't be so confident to submit a PR. 🙏

brc-dd commented 2 weeks ago

notFoundPageData.relativePath needs to be kept as empty because only one 404.html page is generated and I don't think any popular host supports localized error pages. We can however fix this problem similar to how we are determining the root link inside onMounted hook.

NozomuIkuta commented 2 weeks ago

@brc-dd

Thank you for the quick fix! But, unfortunately #3833 resolved the issue only partially. 🙌

themeConfig for NotFound page is made up on mounted hook of NotFound.vue, which corresponds to main contents of the page. As a result, other components such as layout components (e.g VPFooter) is still not localized.

brc-dd commented 2 weeks ago

I don't think there is any way to fix that except to render 404 completely on client 👀

narumi147 commented 1 week ago

@brc-dd will above mentioned container labels support locales? it seems still not fixed yet

brc-dd commented 1 week ago

You can customize those but cannot override based on locale. Track https://github.com/vuejs/vitepress/issues/3141#issuecomment-1784021955 for that. The current workaround is to always specify titles on blocks.

narumi147 commented 1 week ago

Yeah, customizable but not localized, I will track that issue, thanks. though it is inactive for half a year already