mirror of
https://github.com/kremalicious/asi-calculator.git
synced 2024-12-22 09:23:16 +01:00
12 lines
346 B
TypeScript
12 lines
346 B
TypeScript
|
import { NextResponse, type NextRequest } from 'next/server'
|
||
|
|
||
|
export function middleware(request: NextRequest) {
|
||
|
// add x-locale header to all responses
|
||
|
const locale =
|
||
|
request.headers.get('accept-language')?.split(',')?.[0] || 'en-US'
|
||
|
const response = NextResponse.next()
|
||
|
response.headers.set('x-locale', locale)
|
||
|
|
||
|
return response
|
||
|
}
|