svelte-i18n dem Projekt hinzugefügt für die Möglichkeit, statische Texte sauberer an einer zentralen Stelle zu pflegen. Über den Language-Chooser wird die aktuelle locale der Übersetzungen auch gleich mit umgeschaltet.

This commit is contained in:
2022-06-01 08:02:50 +02:00
parent 87aa1689f3
commit aaf2860714
9 changed files with 147 additions and 10 deletions

View File

@@ -1,4 +1,5 @@
<script lang="ts">
import { _ } from "svelte-i18n"
import { Router, Route } from "svelte-routing"
import { scrollToTop } from "svelte-scrollto"
import { generalInfo, location, currentLang } from "../store"
@@ -59,6 +60,8 @@
<Header />
{$_("test")}
<Router url="{url}">
<Route path="/" let:params>
<Home />

View File

@@ -1,4 +1,5 @@
<script lang="ts">
import { locale } from "svelte-i18n"
import { navigate } from "svelte-routing"
import { navigations, location, currentLang } from "../../store"
@@ -17,6 +18,7 @@
const setLanguage = (lang: string) => {
$currentLang = lang
locale.set($currentLang)
}
</script>