QuiiBz / next-international

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

On cookies #240

Closed kristofferso closed 10 months ago

kristofferso commented 10 months ago

I'm using Firefox, which is showing some warnings about the Next-Locale cookie misusing the samesite attribute. Since the cookie is not used by third parties, it's not really an issue. However it got me thinking about if this package could be used cookielss. The locale is always stored in the url anyways for all page requests. Is it necessary? Could next-international be expanded to support this?

gustaveWPM commented 10 months ago

Hello!

This problem has already been discussed here: https://github.com/QuiiBz/next-international/issues/188 And I think this is indeed the path Next International intends to take? (Given that, for the time being, we have concluded that getting rid of the [locale] route and rely on the cookie instead was not a good idea.)

EDIT: The response below gives a very good reason for not completely getting rid of the cookie. I had forgotten this point.

QuiiBz commented 10 months ago

The cookie is currently used to retrieve the previous locale if a user comes back to your site. I'm not too familiar with the SameSite or other cookie attributes, but if it produces a warning, we should fix it.

QuiiBz commented 10 months ago

Closing as we don't have more information for now, but happy to go forward and fix any issue/warning in our current cookies usage.

kristofferso commented 10 months ago

Added a PR here: https://github.com/QuiiBz/next-international/pull/269