2024-06-16 14:21:26 +01:00
|
|
|
export const prerender = true;
|
2024-08-31 18:46:52 +01:00
|
|
|
export const ssr = true;
|
2024-07-02 19:16:03 +01:00
|
|
|
|
|
|
|
import { browser } from '$app/environment';
|
|
|
|
|
|
|
|
import { get } from 'svelte/store';
|
|
|
|
import type { Load } from '@sveltejs/kit';
|
|
|
|
|
|
|
|
import { loadTranslations, defaultLocale } from '$lib/i18n/translations';
|
|
|
|
|
|
|
|
export const load: Load = async ({ url }) => {
|
|
|
|
const { pathname } = url;
|
|
|
|
|
|
|
|
let preferredLocale = defaultLocale;
|
|
|
|
|
|
|
|
if (browser) {
|
2024-07-20 15:37:52 +01:00
|
|
|
preferredLocale = get((await import('$lib/i18n/locale')).default);
|
2024-07-02 19:16:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
await loadTranslations(preferredLocale, pathname);
|
|
|
|
return {};
|
|
|
|
}
|