This commit is contained in:
Your Name committed 2026-06-20 20:33:34 -04:00
1 parent 78f2cb62aa
commit aefa13e363
6 files changed
+209 -17

No files matched your search

+10 -3
View File
@@ -18,12 +18,19 @@ export function proxy(request: NextRequest) {
}
// Check if the pathname already has a locale
const pathnameHasLocale = SUPPORTED_LOCALES.some(
const matchedLocale = SUPPORTED_LOCALES.find(
(locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}`
);
if (pathnameHasLocale) {
return NextResponse.next();
if (matchedLocale) {
const requestHeaders = new Headers(request.headers);
requestHeaders.set('x-homaroma-locale', matchedLocale);
return NextResponse.next({
request: {
headers: requestHeaders,
},
});
}
// Determine the preferred locale