webui/src/routes/+layout.ts

20 lines
544 B
TypeScript
Raw Normal View History

2023-11-19 19:27:22 +00:00
import '$lib/style/app.scss';
2023-11-17 00:05:35 +00:00
2023-11-19 19:27:22 +00:00
import { browser } from '$app/environment';
import '$lib/i18n'; // Import to initialize. Important :)
import { locale, waitLocale } from 'svelte-i18n';
import type { LayoutLoad } from './$types';
2023-11-17 00:05:35 +00:00
export const load: LayoutLoad = async () => {
2023-11-19 19:27:22 +00:00
if (browser && localStorage.getItem('locale')) {
locale.set(localStorage.getItem('locale'));
} else if (browser) {
locale.set(window.navigator.language);
2023-11-17 00:05:35 +00:00
}
2023-11-19 19:27:22 +00:00
await waitLocale();
};
2023-11-17 00:05:35 +00:00
2023-11-17 10:09:06 +00:00
export const prerender = true;
export const ssr = false;
2023-11-19 19:27:22 +00:00
export const csr = true;