QuiiBz / next-international

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

[disccusion] is it ok to call setStaticParamsLocale in layout.tsx #172

Closed landvibe closed 1 year ago

landvibe commented 1 year ago

Calling setStaticParamsLocale in every page.tsx is a cumbersome task. It seems that calling setStaticParamsLocale in a dynamic page is also fine. So, it's most convenient to call setStaticParamsLocale in the root's layout.tsx. Is that okay to do?

QuiiBz commented 1 year ago

Unfortunately, that's a Next.js issue. You can't share in-memory stuff from layouts to pages using cache(), that's we manually have to call setStaticParamsLocale on every page.

As soon as there is a way to share data from layouts down to pages, we'll update next-international to use it.