How to sync url locale & cookie locale after using browser back / forward / fresh? #1421
Unanswered
GrahamQuan
asked this question in
Q&A
Replies: 1 comment
-
client side not work, but could do it in server side export default function middleware(request: NextRequest) {
...
i18nResponse.cookies.set('NEXT_LOCALE', locale);
...
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
[question]
How to sync url locale & cookie locale after using browser back / forward / fresh?
[ref]
Been using next-intl for a while, everything feels great on RSC and client side, but recently I found out that next 13
/app
removerouter.event
which may be a issue when we use browser back / forward / fresh with next-intl, and it happened. Link: vercel/next.js#41934 (comment)[behavior]
/en/pricing
(cookie localeen
)/ja/pricing
(cookie localeja
)/en/pricing
(cookie locale stillja
)/en/blog
(cookie locale stillja
)[code]
I have a
customFetch
function get locale from cookie, cookie is legacy so this function will be an issue, code be like[next-intl setup]
[version]
Beta Was this translation helpful? Give feedback.
All reactions