trifid/tfweb/src/hooks.server.ts

11 lines
296 B
TypeScript
Raw Normal View History

2023-05-30 22:50:47 +00:00
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)
}