mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-05 12:11:51 +02:00
Fix languages issues
This commit is contained in:
parent
88d255da1b
commit
403b2aa1b0
7 changed files with 34 additions and 8 deletions
|
@ -19,7 +19,10 @@ export async function middleware(request: NextRequest) {
|
|||
return;
|
||||
}
|
||||
|
||||
const locale = getPreferredLocale(request);
|
||||
const locale = getPreferredLocale({
|
||||
acceptLanguageHeader: request.headers.get("accept-language") ?? undefined,
|
||||
});
|
||||
|
||||
request.nextUrl.pathname = `/${locale}${pathname}`;
|
||||
|
||||
if (locale === "en") {
|
||||
|
|
|
@ -19,7 +19,12 @@ export const middleware = withAuth(async (req) => {
|
|||
return NextResponse.redirect(newUrl);
|
||||
}
|
||||
|
||||
const locale = req.auth?.user?.locale || getPreferredLocale(req);
|
||||
const locale =
|
||||
req.auth?.user?.locale ||
|
||||
getPreferredLocale({
|
||||
acceptLanguageHeader: req.headers.get("accept-language") ?? undefined,
|
||||
});
|
||||
|
||||
if (supportedLocales.includes(locale)) {
|
||||
newUrl.pathname = `/${locale}${pathname}`;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue