diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-09-28 18:28:33 +0200 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-09-28 18:28:33 +0200 |
| commit | f9337bbe280878c2a2d9d713873c4c06b54325cd (patch) | |
| tree | bbc30d1b0dfb5c3589af609e28db04b12c11b237 /apps/kit/src/routes/(main)/+layout.ts | |
| parent | 59a4a340c77aad97e299aac47155bf4bff7a3c30 (diff) | |
| download | greatoffice-f9337bbe280878c2a2d9d713873c4c06b54325cd.tar.xz greatoffice-f9337bbe280878c2a2d9d713873c4c06b54325cd.zip | |
refactor: !WIP Use i18n namespaces
Diffstat (limited to 'apps/kit/src/routes/(main)/+layout.ts')
| -rw-r--r-- | apps/kit/src/routes/(main)/+layout.ts | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/apps/kit/src/routes/(main)/+layout.ts b/apps/kit/src/routes/(main)/+layout.ts index de8a5c0..f673067 100644 --- a/apps/kit/src/routes/(main)/+layout.ts +++ b/apps/kit/src/routes/(main)/+layout.ts @@ -1,9 +1,19 @@ -import type {Locales} from "$lib/i18n/i18n-types"; -import {loadLocaleAsync} from "$lib/i18n/i18n-util.async"; -import type {LayoutLoad} from "./$types"; +import type { Locales } from "$lib/i18n/i18n-types"; +import { loadLocaleAsync, loadNamespaceAsync } from "$lib/i18n/i18n-util.async"; +import type { LayoutLoad } from "./$types"; -export const load: LayoutLoad<{ locale: Locales }> = async ({url, params}) => { +export const load: LayoutLoad<{ locale: Locales }> = async ({ url, params }) => { let lang = "en" as Locales; await loadLocaleAsync(lang); - return {locale: lang}; + + if (url.pathname.startsWith("/sign-in")) { + await loadNamespaceAsync(lang, "sign-in"); + } + if (url.pathname.startsWith("/sign-up")) { + await loadNamespaceAsync(lang, "sign-up"); + } + if (url.pathname.startsWith("/reset-password")) { + await loadNamespaceAsync(lang, "reset-password"); + } + return { locale: lang }; };
\ No newline at end of file |
