QuiiBz / next-international

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

Using `headers` function forces dynamic rendering in `getI18n()` #160

Closed clopos-kamran closed 1 year ago

clopos-kamran commented 1 year ago

Describe the bug I want to be able to use server generated static pages using app router. But when I use getI18n() in components it switches to dynamic rendering because of this rule

headers() is a Dynamic Function whose returned values cannot be known ahead of time. Using it in a layout or page will opt a route into dynamic rendering at request time.

To Reproduce Steps to reproduce the behavior: Follow the instructions in here

Expected behavior It should immediately return from cache. If I export my own getI18n() function and return translations for only one language it loads very fast which indicates that dynamic rendering is not turned on.

About (please complete the following information):

QuiiBz commented 1 year ago

Static Rendering will be released very soon as part of the v1 release:

You can already update by installing next-international@1.0.0-rc.6 and following the upgrade guide in the above PR.