fix(web): persisted store (#18385)

* fix(web): persisted store

* fix: translation

* fix: test

* fix: test

* revert i18n changes

* fix blank locale
This commit is contained in:
Daimolean 2025-06-04 03:27:23 +08:00 committed by GitHub
parent 6b4d5e3beb
commit daf1bee7ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 64 additions and 40 deletions

View file

@ -1,13 +1,20 @@
<script lang="ts">
import { Theme } from '$lib/constants';
import { defaultLang, langs, Theme } from '$lib/constants';
import { themeManager } from '$lib/managers/theme-manager.svelte';
import { lang } from '$lib/stores/preferences.store';
import { ThemeSwitcher } from '@immich/ui';
import { get } from 'svelte/store';
</script>
{#if !themeManager.theme.system}
<ThemeSwitcher
size="medium"
color="secondary"
onChange={(theme) => themeManager.setTheme(theme == 'dark' ? Theme.DARK : Theme.LIGHT)}
/>
{#await langs
.find((item) => item.code === get(lang))
?.loader() ?? defaultLang.loader() then { default: translations }}
<ThemeSwitcher
size="medium"
color="secondary"
{translations}
onChange={(theme) => themeManager.setTheme(theme == 'dark' ? Theme.DARK : Theme.LIGHT)}
/>
{/await}
{/if}