Skip to content

Commit 7db5b3e

Browse files
committed
add simple locale switcher
1 parent e2fe03c commit 7db5b3e

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

messages/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"$schema": "https://inlang.com/schema/inlang-message-format",
33
"quiet_chunky_jay_empower": "Welcome to {name}!",
4-
"fit_candid_spider_adore": "Visit <a href=\"https://kit.svelte.dev\">kit.svelte.dev</a> to read the documentation."
4+
"fit_candid_spider_adore": "Visit <a href=\"https://kit.svelte.dev\">kit.svelte.dev</a> to read the documentation.",
5+
"house_patchy_flamingo_link": "Home"
56
}

messages/es.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"$schema": "https://inlang.com/schema/inlang-message-format",
33
"quiet_chunky_jay_empower": "¡Bienvenido a {name}!",
4-
"fit_candid_spider_adore": "Visita <a href=\"https://kit.svelte.dev\">kit.svelte.dev</a> para leer la documentación."
4+
"fit_candid_spider_adore": "Visita <a href=\"https://kit.svelte.dev\">kit.svelte.dev</a> para leer la documentación.",
5+
"house_patchy_flamingo_link": "Inicio"
56
}

src/app.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
@plugin '@tailwindcss/container-queries';
77

88
@theme {
9-
--font-sans: 'Inter Variable', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
10-
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
9+
--font-sans: 'Inter Variable', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji',
10+
'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
1111
--breakpoint-xs: 475px;
1212
--breakpoint-3xl: 1920px;
1313
}

src/lib/components/header.svelte

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<script lang="ts">
2+
import * as m from '$lib/paraglide/messages.js';
3+
import LocaleSwitcher from '$components/locale-switcher.svelte';
4+
</script>
5+
6+
<header class="flex items-center justify-between">
7+
<a href="/">{m.house_patchy_flamingo_link()}</a>
8+
9+
<LocaleSwitcher />
10+
</header>

src/routes/+layout.svelte

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
import { i18n } from '$lib/i18n';
55
import { ModeWatcher } from 'mode-watcher';
66
import { ParaglideJS } from '@inlang/paraglide-sveltekit';
7+
import Header from '$components/header.svelte';
78
89
let { children } = $props();
910
</script>
1011

1112
<ModeWatcher />
1213

1314
<ParaglideJS {i18n}>
15+
<Header />
16+
1417
{@render children()}
1518
</ParaglideJS>

0 commit comments

Comments
 (0)