fix: translation

This commit is contained in:
Tobias Klemp
2025-12-03 20:52:19 +01:00
parent 42080520bf
commit 2806575233
8 changed files with 262 additions and 11 deletions

View File

@@ -6,8 +6,25 @@
Tolgee,
DevTools,
FormatSimple,
type TolgeeStaticData,
} from '@tolgee/svelte'
import { TopBar } from '$lib/components/ui/topBar'
import {
PUBLIC_TOLGEE_API_KEY,
PUBLIC_TOLGEE_API_URL,
} from '$env/static/public'
import type { Snippet } from 'svelte'
let { children, data }: { data: TolgeeStaticData; children: Snippet } =
$props()
function getLang(lang: string) {
return async (): Promise<Record<string, any>> => {
const res = await fetch(`/lang/${lang}`)
const translations = await res.json()
return translations
}
}
const tolgee = Tolgee()
.use(DevTools())
@@ -15,15 +32,15 @@
.init({
language: 'de',
// for development
apiUrl: import.meta.env.VITE_TOLGEE_API_URL,
apiKey: import.meta.env.VITE_TOLGEE_API_KEY,
// // for development
// apiUrl: PUBLIC_TOLGEE_API_URL,
// apiKey: PUBLIC_TOLGEE_API_KEY,
// for production
staticData: {},
staticData: {
de: data['de'] ?? getLang('de'),
},
})
let { children } = $props()
</script>
<svelte:head>