File size: 550 Bytes
43a06dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
export const prerender = true;
export const ssr = true;

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) {
        preferredLocale = get((await import('$lib/i18n/locale')).default);
    }

    await loadTranslations(preferredLocale, pathname);
    return {};
}