diff options
| author | Fuwn <[email protected]> | 2024-01-21 23:22:40 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-01-21 23:22:40 -0800 |
| commit | c0d25435085fed69c08372c5b0407abadf07155d (patch) | |
| tree | 4c9622d335dabdd1201273af7ad7c3c4030ed416 | |
| parent | refactor(locale): use consistent casing (diff) | |
| download | due.moe-c0d25435085fed69c08372c5b0407abadf07155d.tar.xz due.moe-c0d25435085fed69c08372c5b0407abadf07155d.zip | |
refactor(layout): migrate to global locale store
| -rw-r--r-- | src/routes/+layout.svelte | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 70d336bc..5c01cb98 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -13,10 +13,11 @@ import Notification from '$lib/Notification/Notification.svelte'; import Root from '$lib/Home/Root.svelte'; import root from '$lib/Utility/root'; - import { addMessages, init, _, locale } from 'svelte-i18n'; + import { addMessages, init, locale as i18nLocale } from 'svelte-i18n'; import english from '$lib/Locale/english'; import japanese from '$lib/Locale/japanese'; import type { LocaleDictionary } from '$lib/Locale/layout'; + import locale from '$stores/locale'; export let data; @@ -24,7 +25,7 @@ addMessages('ja', japanese as unknown as LocaleDictionary); init({ fallbackLocale: 'en', initialLocale: $settings.displayLanguage }); - $: locale.set($settings.displayLanguage); + $: i18nLocale.set($settings.displayLanguage); let currentUserIdentity = { name: '', @@ -73,22 +74,22 @@ <div id="container"> <div id="header" class="card card-centered"> <div> - <a href={root('/')} class="header-item">{$_('navigation.home')}</a><a + <a href={root('/')} class="header-item">{$locale().navigation.home}</a><a href={root('/completed')} class="header-item" > - {$_('navigation.completed')} + {$locale().navigation.completed} </a> - <a href={root('/schedule')} class="header-item">{$_('navigation.subtitle_schedule')}</a> - <a href={root('/updates')} class="header-item">{$_('navigation.new_releases')}</a> - <a href={root('/tools')} class="header-item">{$_('navigation.tools')}</a> - <a href={root('/settings')} class="header-item">{$_('navigation.settings')}</a> + <a href={root('/schedule')} class="header-item">{$locale().navigation.subtitleSchedule}</a> + <a href={root('/updates')} class="header-item">{$locale().navigation.newReleases}</a> + <a href={root('/tools')} class="header-item">{$locale().navigation.tools}</a> + <a href={root('/settings')} class="header-item">{$locale().navigation.settings}</a> <span style="opacity: 50%;" class="header-item">|</span> {#if data.user} <a href={root(`/user/${currentUserIdentity.name}`)} class="header-item"> - {$_('navigation.profile')} + {$locale().navigation.profile} </a> {/if} @@ -103,11 +104,11 @@ ); }} > - {$_('navigation.log_in')} + {$locale().navigation.logIn} </a> {:else} <a href={root('/api/authentication/log-out')} class="header-item"> - {$_('navigation.log_out')} + {$locale().navigation.logOut} </a> {#if data.user} <a href={root(`/user/${currentUserIdentity.name}`)} class="header-item"> |