feat: add language selector
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://inlang.com/schema/inlang-message-format",
|
"$schema": "https://inlang.com/schema/inlang-message-format",
|
||||||
|
"language": "Deutsch - German",
|
||||||
"saved": {
|
"saved": {
|
||||||
"home": "Heim",
|
"home": "Heim",
|
||||||
"school": "Schule",
|
"school": "Schule",
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://inlang.com/schema/inlang-message-format",
|
"$schema": "https://inlang.com/schema/inlang-message-format",
|
||||||
|
"language": "English",
|
||||||
"save": "Save",
|
"save": "Save",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"loading": "Loading...",
|
"loading": "Loading...",
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
import OfflineMapsSidebar from "./sidebar/settings/OfflineMapsSidebar.svelte";
|
import OfflineMapsSidebar from "./sidebar/settings/OfflineMapsSidebar.svelte";
|
||||||
import DeveloperSidebar from "./sidebar/settings/DeveloperSidebar.svelte";
|
import DeveloperSidebar from "./sidebar/settings/DeveloperSidebar.svelte";
|
||||||
import { m } from "$lang/messages";
|
import { m } from "$lang/messages";
|
||||||
|
import LanguageSidebar from "./sidebar/settings/LanguageSidebar.svelte";
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const views: Record<string, Component<any>> = {
|
const views: Record<string, Component<any>> = {
|
||||||
@ -45,6 +46,7 @@
|
|||||||
about: AboutSidebar,
|
about: AboutSidebar,
|
||||||
"offline-maps": OfflineMapsSidebar,
|
"offline-maps": OfflineMapsSidebar,
|
||||||
"dev-options": DeveloperSidebar,
|
"dev-options": DeveloperSidebar,
|
||||||
|
language: LanguageSidebar
|
||||||
};
|
};
|
||||||
|
|
||||||
let isDragging = false;
|
let isDragging = false;
|
||||||
|
|||||||
@ -0,0 +1,31 @@
|
|||||||
|
<script>
|
||||||
|
import { m } from "$lang/messages";
|
||||||
|
import { getLocale, locales, setLocale } from "$lang/runtime";
|
||||||
|
import { CheckIcon, LanguagesIcon } from "@lucide/svelte";
|
||||||
|
import SidebarHeader from "../SidebarHeader.svelte";
|
||||||
|
import SettingsButton from "./SettingsButton.svelte";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<SidebarHeader>
|
||||||
|
{m["sidebar.language.header"]()}
|
||||||
|
</SidebarHeader>
|
||||||
|
|
||||||
|
<div id="languages">
|
||||||
|
{#each locales as locale}
|
||||||
|
{#if locale == getLocale()}
|
||||||
|
<SettingsButton text={m.language()} icon={CheckIcon} disabled />
|
||||||
|
{:else}
|
||||||
|
<SettingsButton text={m.language({}, { locale })} icon={LanguagesIcon} onclick={() => {
|
||||||
|
setLocale(locale)
|
||||||
|
}} />
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
#languages {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -19,7 +19,7 @@
|
|||||||
<div id="sections">
|
<div id="sections">
|
||||||
<section>
|
<section>
|
||||||
<h2>{m["sidebar.settings.general"]()}</h2>
|
<h2>{m["sidebar.settings.general"]()}</h2>
|
||||||
<SettingsButton icon={LanguagesIcon} text={m["sidebar.language.header"]()} disabled />
|
<SettingsButton icon={LanguagesIcon} text={m["sidebar.language.header"]()} view="language" />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
|||||||
Reference in New Issue
Block a user