We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 280c12b commit 00726f9Copy full SHA for 00726f9
middleware.ts
@@ -19,7 +19,10 @@ export const middleware = async (request: NextRequest) => {
19
20
// If we already have a NEXT_LOCALE Cookie, then Redirect to the stored Locale Code
21
if (localeCookie?.value && localeCookie.value !== 'default') {
22
- return redirectWithLocale(localeCookie.value);
+ // If the language by any reason is not available anymore, ignore the cookie
23
+ if (availableLocales.some(locale => locale.code === localeCookie.value)) {
24
+ return redirectWithLocale(localeCookie.value);
25
+ }
26
}
27
28
// If not, we try to check if the Browser is sending `Accept-Language` Header
0 commit comments