From 505386adbad6a07285cfcd7e64a1b3e609c1c5e8 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 2 May 2023 14:09:51 -0700 Subject: nfc wip --- src/routes/+layout.server.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/routes/+layout.server.js (limited to 'src/routes/+layout.server.js') diff --git a/src/routes/+layout.server.js b/src/routes/+layout.server.js new file mode 100644 index 00000000..53be7741 --- /dev/null +++ b/src/routes/+layout.server.js @@ -0,0 +1,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 }; +}; -- cgit v1.2.3