diff options
| author | Adam Soltys <[email protected]> | 2023-01-05 17:20:44 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-01-05 17:20:44 -0800 |
| commit | 5a8e837042876033a792525740665553bc1a89cf (patch) | |
| tree | d31c4b51283f4eafc3ae3b1298d089fd5a331413 /src/routes | |
| parent | d2582a22a6df7c257281d9511ad07a2d72498d26 (diff) | |
| download | coinos-ui-5a8e837042876033a792525740665553bc1a89cf.tar.gz coinos-ui-5a8e837042876033a792525740665553bc1a89cf.zip | |
support server side translations
Diffstat (limited to 'src/routes')
| -rw-r--r-- | src/routes/+layout.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/routes/+layout.js b/src/routes/+layout.js new file mode 100644 index 00000000..add74f87 --- /dev/null +++ b/src/routes/+layout.js @@ -0,0 +1,8 @@ +import { loadTranslations, locale } from '$lib/translations'; +export const load = async ({ url }) => { + const { 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 {}; +}; |
