QuiiBz / next-international

Type-safe internationalization (i18n) for Next.js
https://next-international.vercel.app
MIT License
1.2k stars 54 forks source link

How to work with custom `not-found.tsx` and `error.tsx` with app router static export? #268

Closed alienzhangyw closed 8 months ago

alienzhangyw commented 8 months ago

They're not working after I put all files into [locale] folder. My file struct: image

localhost:4000/404 showing error: image

localhost:4000/en-US/404 showing white screen and multiple console errors: image

Related issue: https://github.com/vercel/next.js/issues/54239

QuiiBz commented 8 months ago

This seems like an issue with Next.js, and not specifically related to next-international. Apparently you have to move not-found.tsx outside the [locale] folder, directly into app, with an empty layout file.

alienzhangyw commented 8 months ago

This seems like an issue with Next.js, and not specifically related to next-international. Apparently you have to move not-found.tsx outside the [locale] folder, directly into app, with an empty layout file.

But I cannot internationalize the custom 404 page if I move it out

QuiiBz commented 8 months ago

But I cannot internationalize the custom 404 page if I move it out

Yes I known, but I don't have any other solution for now since this is a Next.js bug :(

alienzhangyw commented 8 months ago

OK, close for now.

kiennt2 commented 8 months ago

https://github.com/vercel/next.js/issues/55555#issuecomment-1724887409

try this, it work for me :D