implemented storing of user's language as well as loading
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { Router, Route } from 'svelte-tiny-router';
|
||||
|
||||
import { loadTranslation } from './translations.svelte.js';
|
||||
@@ -39,10 +38,11 @@
|
||||
|
||||
let translations_ready = $state(false);
|
||||
|
||||
onMount(async () => {
|
||||
await loadTranslation('de','Login');
|
||||
async function load(){
|
||||
loadTheme(user.theme);
|
||||
await loadTranslation(user.language?user.language:'de');
|
||||
translations_ready = true;
|
||||
});
|
||||
}
|
||||
|
||||
function loadTheme(name){
|
||||
if (!name) return;
|
||||
@@ -56,7 +56,7 @@
|
||||
next();
|
||||
}
|
||||
|
||||
$effect(() => loadTheme(user.theme));
|
||||
$effect(load);
|
||||
</script>
|
||||
|
||||
{#if translations_ready }
|
||||
|
||||
Reference in New Issue
Block a user