i18nexus / next-i18n-router

Next.js App Router internationalized routing and locale detection.
MIT License
257 stars 19 forks source link

Support localStorage #62

Closed monolithed closed 7 months ago

monolithed commented 7 months ago

It's important to support localStorage 'cause implementing through cookies requires writing a privacy policy and implementing a mechanism for obtaining consent to use cookies and their processing (GDPR).

i18nexus commented 7 months ago

If you want to use localStorage, that's possible. Just set the serverSetCookie option to never. If you have a language selector component like in our examples, you just need to have it set the current language in localStorage instead of setting a cookie. You would also need to make sure to prefix the current locale on all hrefs in Links throughout your app.