fix: i18n

This commit is contained in:
Andras Bacsai 2022-04-21 10:05:27 +02:00
parent fe3702847a
commit 029b623f08
2 changed files with 7 additions and 2 deletions

View File

@ -1,8 +1,13 @@
<script context="module" lang="ts"> <script context="module" lang="ts">
import type { Load } from '@sveltejs/kit'; import type { Load } from '@sveltejs/kit';
import { publicPaths } from '$lib/settings'; import { publicPaths } from '$lib/settings';
import { locale, loadTranslations } from '$lib/translations';
export const load: Load = async ({ fetch, url, session }) => { export const load: Load = async ({ fetch, url, session }) => {
const { pathname } = url;
const defaultLocale = 'en';
const initLocale = locale.get() || defaultLocale;
await loadTranslations(initLocale, pathname);
if (!session.userId && !publicPaths.includes(url.pathname)) { if (!session.userId && !publicPaths.includes(url.pathname)) {
return { return {
status: 302, status: 302,

View File

@ -60,7 +60,7 @@
: window.location.hostname : window.location.hostname
: database.id : database.id
}:${isPublic ? database.publicPort : privatePort}/${databaseDefault}` }:${isPublic ? database.publicPort : privatePort}/${databaseDefault}`
: $t('forms.loading'); : $t('forms.loading'));
} }
async function changeSettings(name) { async function changeSettings(name) {