admin管理员组文章数量:1415420
My website has translations, and I want to translate my error pages. But I translate my pages with a dynamic route (/app/[locale]
) and not-found.tsx
must be at the root (app/not-found.tsx
). I don't use any libraries for my internationalisation.
What I tried: I created a custom error page in my /app/[locale]/
folder at /app/[locale]/404/page.tsx
.
Then, my middleware sends all the non-valid urls to /[locale]/404
with the right locale.
The problem is: I can't find a way to fire a 404 status code.
I tried to set the status code from the middleware, but then I can't redirect to my custom error page. (NextResponse.redirect doesn't support status codes).
I tried using use notFound()
in 404/page.tsx
, but then app/not-found.tsx
is rendered and not 404/page.tsx
.
本文标签: internationalizationHow to translate the notfound page in NextJSStack Overflow
版权声明:本文标题:internationalization - How to translate the not-found page in Next.JS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745203324a2647505.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论