QuiiBz / next-international

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

What is the difference between `createI18n`, `createI18nClient`, `createI18nServer` ? #179

Closed sshmaxime closed 12 months ago

sshmaxime commented 12 months ago

I understand the difference between createI18nClient and createI18nServer but what is createI18n exactly ?

(Might wanna move this to discussion instead)

QuiiBz commented 12 months ago

createI18n is used when your Next.js application uses the Pages Router: https://next-international.vercel.app/docs/pages-setup

createI18nClient / createI18nServer are only used when using the App Router. I tried to keep the APIs similar as much as possible between the two routers to make it easier when migrating from one to another. Feel free to re-open an issue if that doesn't answer your question!

sshmaxime commented 12 months ago

Alright thank you, could you then update the tests with the App Router please ?

QuiiBz commented 12 months ago

See https://github.com/QuiiBz/next-international/issues/178#issuecomment-1725326931 - I'll update the tests for the App Router when we have a clear view of how to test things with Next.js, since it's currently unclear.