next-intl - how NEXT_LOCALE cookie is set
Answered
Cuban Crocodile posted this in #help-forum
Cuban CrocodileOP
Hello!
I am building an app with multi-languages that are fetched from a GraphQL call. The GraphQL call is working well, but I cannot manage how NEXT_LOCALE cookie is working.
If I am deleting it from Chrome, my application says : "Error: Unable to find
If I keep it on Chrome, e.g. with "en" value and then I am switching to "fr" lang (by a <select> that modifies the URL) the cookie is not updating to reflect the new value. As a consequence, two calls are made (one in "en", one in "fr" and it is the last one that is used for translations.
Can you help me to understand?
Thanks!
I am building an app with multi-languages that are fetched from a GraphQL call. The GraphQL call is working well, but I cannot manage how NEXT_LOCALE cookie is working.
If I am deleting it from Chrome, my application says : "Error: Unable to find
next-intl locale, have you configured the middleware?" even if in my middleware.ts I set the default language as "en"If I keep it on Chrome, e.g. with "en" value and then I am switching to "fr" lang (by a <select> that modifies the URL) the cookie is not updating to reflect the new value. As a consequence, two calls are made (one in "en", one in "fr" and it is the last one that is used for translations.
Can you help me to understand?
Thanks!
Answered by Cuban Crocodile
Problem seems to be solved. middleware.ts file was in the root folder instead of src...
2 Replies
Cuban CrocodileOP
Problem seems to be solved. middleware.ts file was in the root folder instead of src...
Answer
Tonkinese
Hey @Cuban Crocodile, how does your language switcher work?