You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, there is no way to override the defaultLocale, it will always be set based on the accept-language header. The following config does nothing for me, it's always the browser header that decides
I think the order of resolving the locale should be default locale prio 3 and accept language should be prio 4
If that would be the case, the accept-language header would never be used (since a defaultLocale is mandatory).
Can you share more details on your use case?
By composing the middleware, you should have plenty of freedom. E.g. to force a particular locale for a given request, you can set the defaultLocale dynamically, limit the available locales, turn off localeDetection etc.
If you have a very special use case where the next-intl middleware doesn't help much, you can also implement your own.
So how we can override the locale for users for the first time. Since defaultLocale is not a priority, what can we do so that for example default language for all users be German but later if they want to switch to English, they can, and it would be remembered for all following visits to the application?
You can add a redirect if a user requests the app and no NEXT_LOCALE cookie is available from a previous visit. I'll close this issue now since it seems to be a usage question.
Is your feature request related to a problem? Please describe.
Currently, there is no way to override the defaultLocale, it will always be set based on the
accept-language
header. The following config does nothing for me, it's always the browser header that decidesDescribe the solution you'd like
I want to be able to override the defaultLocale by giving more priority to the
defaultLocale
config optionI think the order of resolving the locale should be default locale
prio 3
and accept language should beprio 4
next-intl/packages/next-intl/src/middleware/resolveLocale.tsx
Line 57 in f8cdcf2
Describe alternatives you've considered
Can't seem to find a workaround, maybe I can try initially setting NEXT_LOCALE to
de
in the middlewareThe text was updated successfully, but these errors were encountered: