12 lines
284 B
TypeScript
12 lines
284 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(',');
|
||
|
if (lang) {
|
||
|
locale.set(lang);
|
||
|
}
|
||
|
|
||
|
return resolve(event);
|
||
|
};
|