webui/src/hooks.server.ts
2023-11-17 01:05:35 +01:00

10 lines
No EOL
277 B
TypeScript

import type { Handle } from '@sveltejs/kit'
import { locale } from 'svelte-i18n'
export const handle: Handle = async ({ event, resolve }) => {
const lang = event.request.headers.get('accept-language')?.split(',')[0]
if (lang) {
locale.set(lang)
}
return resolve(event)
}