This commit is contained in:
Your Name committed 2026-06-20 18:57:24 -04:00
1 parent f7aa4d099f
commit ab3e53c4da
33 files changed
+290 -69

No files matched your search

+4 -4
View File
@@ -31,15 +31,15 @@ export function proxy(request: NextRequest) {
const cookieLocale = request.cookies.get('homaroma_lang')?.value;
let targetLocale = DEFAULT_LOCALE;
if (cookieLocale && SUPPORTED_LOCALES.includes(cookieLocale as any)) {
targetLocale = cookieLocale as any;
if (cookieLocale && (SUPPORTED_LOCALES as readonly string[]).includes(cookieLocale)) {
targetLocale = cookieLocale as typeof SUPPORTED_LOCALES[number];
} else {
// 2. Check Accept-Language header
const acceptLang = request.headers.get('accept-language');
if (acceptLang) {
const preferred = acceptLang.split(',')[0].split('-')[0].toLowerCase();
if (SUPPORTED_LOCALES.includes(preferred as any)) {
targetLocale = preferred as any;
if ((SUPPORTED_LOCALES as readonly string[]).includes(preferred)) {
targetLocale = preferred as typeof SUPPORTED_LOCALES[number];
}
}
}