-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to opt out from using cookies or headers? #366
Comments
Hi, we had the same issue and solved it by using a custom middleware which gets the locale and adds it to the request using a copied and pasted version of addLocaleToResponse. This might lead to other side effects, though. Overall, I think it would be great to add proper support for this. As I see it, this might not actually need a lot of changes (if any) in the implementation of at least the app router part of this package, but is merely a question of adding documentation and exporting |
@zfm-lucaschultz isn't that the same? What I need is to set the locale directly in the root layout. Or am I missing something here? |
I ended up creating a custom implementation that uses https://github.com/manvalls/server-only-context on the server to store the current locale and translations |
You have to call I'm curious to know why you had to use another middleware implementation? |
Is your feature request related to a problem? Please describe.
Right now it gives me the error
Locale not found in headers or cookies, returning "notFound()"
, most likely because I'm not using the default middleware implementation.I don't want to use cookies or headers, since this will cause next to opt out from page caching.
Describe the solution you'd like
using
setStaticParamsLocale
in the root layout would be great. When I tried it didn't work. Maybe this is an issue?Describe alternatives you've considered
--
Additional context
I'm using nextjs 14 with the app router and server components.
The text was updated successfully, but these errors were encountered: