Funktioniert nun auch in Russland
This commit is contained in:
12
proxy.ts
12
proxy.ts
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user