Skip to content

Commit

Permalink
add simple locale switcher
Browse files Browse the repository at this point in the history
  • Loading branch information
buhodev committed Nov 19, 2024
1 parent e2fe03c commit 7db5b3e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
3 changes: 2 additions & 1 deletion messages/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"$schema": "https://inlang.com/schema/inlang-message-format",
"quiet_chunky_jay_empower": "Welcome to {name}!",
"fit_candid_spider_adore": "Visit <a href=\"https://kit.svelte.dev\">kit.svelte.dev</a> to read the documentation."
"fit_candid_spider_adore": "Visit <a href=\"https://kit.svelte.dev\">kit.svelte.dev</a> to read the documentation.",
"house_patchy_flamingo_link": "Home"
}
3 changes: 2 additions & 1 deletion messages/es.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"$schema": "https://inlang.com/schema/inlang-message-format",
"quiet_chunky_jay_empower": "¡Bienvenido a {name}!",
"fit_candid_spider_adore": "Visita <a href=\"https://kit.svelte.dev\">kit.svelte.dev</a> para leer la documentación."
"fit_candid_spider_adore": "Visita <a href=\"https://kit.svelte.dev\">kit.svelte.dev</a> para leer la documentación.",
"house_patchy_flamingo_link": "Inicio"
}
4 changes: 2 additions & 2 deletions src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
@plugin '@tailwindcss/container-queries';

@theme {
--font-sans: 'Inter Variable', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--font-sans: 'Inter Variable', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji',
'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
--breakpoint-xs: 475px;
--breakpoint-3xl: 1920px;
}
Expand Down
10 changes: 10 additions & 0 deletions src/lib/components/header.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script lang="ts">
import * as m from '$lib/paraglide/messages.js';
import LocaleSwitcher from '$components/locale-switcher.svelte';
</script>

<header class="flex items-center justify-between">
<a href="/">{m.house_patchy_flamingo_link()}</a>

<LocaleSwitcher />
</header>
3 changes: 3 additions & 0 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
import { i18n } from '$lib/i18n';
import { ModeWatcher } from 'mode-watcher';
import { ParaglideJS } from '@inlang/paraglide-sveltekit';
import Header from '$components/header.svelte';
let { children } = $props();
</script>

<ModeWatcher />

<ParaglideJS {i18n}>
<Header />

{@render children()}
</ParaglideJS>

0 comments on commit 7db5b3e

Please sign in to comment.