From fd98e6c36a42c1bba7b764f93ffc3ee572ead090 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sat, 27 Apr 2024 22:07:04 -0700 Subject: fix(layout): wait for en locale --- src/routes/+layout.svelte | 191 +++++++++++++++++++++++++--------------------- 1 file changed, 102 insertions(+), 89 deletions(-) (limited to 'src/routes') diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 2bda9e50..5a327169 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -14,7 +14,7 @@ import Notification from '$lib/Notification/Notification.svelte'; import Root from '$lib/Home/Root.svelte'; import root from '$lib/Utility/root'; - import { addMessages, init, locale as i18nLocale } from 'svelte-i18n'; + import { addMessages, init, locale as i18nLocale, locales } from 'svelte-i18n'; import english from '$lib/Locale/english'; import japanese from '$lib/Locale/japanese'; import type { LocaleDictionary } from '$lib/Locale/layout'; @@ -27,6 +27,7 @@ import settingsSyncPulled from '$stores/settingsSyncPulled'; import settingsSyncTimes from '$stores/settingsSyncTimes'; import Announcement from '$lib/Announcement.svelte'; + import Message from '$lib/Loading/Message.svelte'; injectSpeedInsights(); @@ -136,102 +137,114 @@ - - -
-
-
- {$locale().navigation.home} - {$locale().navigation.completed} - - - {$locale().navigation.schedule} - - {$locale().navigation.tools} - {$locale().navigation.settings} - - - - {#if data.user} +{#if !$locales.includes('en')} + + + {#if data.url === '/settings'} + + + + {:else} + + + {/if} +{:else} + + +
+
+
+ {$locale().navigation.home} + {$locale().navigation.completed} + { - localStorage.removeItem('identity'); - localStorage.removeItem('commit'); - - document.cookie = 'user=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; - - window.location.href = root('/api/authentication/log-out'); - } - } + { name: $locale().navigation.subtitleSchedule, url: root('/schedule') }, + { name: $locale().navigation.hololive, url: root('/hololive') }, + { name: $locale().tools.tool.characterBirthdays.short, url: root('/birthdays') }, + { name: $locale().navigation.newReleases, url: root('/updates') } ]} header={false} > - - {$locale().navigation.profile} - + {$locale().navigation.schedule} - {/if} - - {#if data.user === undefined} - { - localStorage.setItem( - 'redirect', - window.location.origin + window.location.pathname + window.location.search - ); - }} - > - {$locale().navigation.logIn} - - {:else if data.user} - - Avatar - - {/if} + {$locale().navigation.tools} + {$locale().navigation.settings} + + + + {#if data.user} + { + localStorage.removeItem('identity'); + localStorage.removeItem('commit'); + + document.cookie = 'user=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; + + window.location.href = root('/api/authentication/log-out'); + } + } + ]} + header={false} + > + + {$locale().navigation.profile} + + + {/if} + + {#if data.user === undefined} + { + localStorage.setItem( + 'redirect', + window.location.origin + window.location.pathname + window.location.search + ); + }} + > + {$locale().navigation.logIn} + + {:else if data.user} + + Avatar + + {/if} +
-
-

- - - - {#if $userIdentity.id !== -1} - - {:else if data.url === '/settings'} - - {:else if data.url === '/tools'} - - {:else if data.url === '/schedule'} - - {:else} - - {/if} - - -

+

+ + + + {#if $userIdentity.id !== -1} + + {:else if data.url === '/settings'} + + + + {:else} + + + {/if} + + +

+{/if}