aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/+layout.server.js
blob: 53be7741c927a6cf332cb5255fad0676b9225264 (plain) (blame)
1
2
3
4
5
6
7
8
import { loadTranslations, locale } from '$lib/translations';
export const load = async ({ url }) => {
	const { host, pathname } = url;
	const defaultLocale = 'en'; // get from cookie, user session, ...
	const initLocale = locale.get() || defaultLocale; // set default if no locale already set
	await loadTranslations(initLocale, pathname); // keep this just before the `return`
	return { host, pathname };
};