Funktioniert nun auch in Russland

This commit is contained in:
BuildTools
2025-12-19 23:47:28 +01:00
parent 5c515c354e
commit 6a03a46837

View File

@@ -14,12 +14,18 @@ export async function proxy(request: NextRequest) {
);
if (!locale) {
const newLang =
let newLang =
request.headers
.get('accept-language')
?.split(',')[0]
?.split('-')[0]
?? 'en';
?.split('-')[0];
if (!newLang)
newLang = routing.defaultLocale;
else {
const langAvailable = (routing.locales as readonly string[]).includes(newLang);
if (!langAvailable) newLang = routing.defaultLocale;
}
const redirect = `/${newLang}`
+ request.nextUrl.pathname