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) {
|
if (!locale) {
|
||||||
const newLang =
|
let newLang =
|
||||||
request.headers
|
request.headers
|
||||||
.get('accept-language')
|
.get('accept-language')
|
||||||
?.split(',')[0]
|
?.split(',')[0]
|
||||||
?.split('-')[0]
|
?.split('-')[0];
|
||||||
?? 'en';
|
|
||||||
|
if (!newLang)
|
||||||
|
newLang = routing.defaultLocale;
|
||||||
|
else {
|
||||||
|
const langAvailable = (routing.locales as readonly string[]).includes(newLang);
|
||||||
|
if (!langAvailable) newLang = routing.defaultLocale;
|
||||||
|
}
|
||||||
|
|
||||||
const redirect = `/${newLang}`
|
const redirect = `/${newLang}`
|
||||||
+ request.nextUrl.pathname
|
+ request.nextUrl.pathname
|
||||||
|
|||||||
Reference in New Issue
Block a user