Anvil/src/hooks.server.ts
André Jaenisch 62aba86d5d
feat: set up internationalisation
This allows for translating the interface using Weblate at
translate.codeberg.org!

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
2024-02-14 12:11:03 +01:00

11 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);
};