Removes duplicated locale logic from +layout.svelte and AppNav.svelte. Context-specific sizing (text-xs/min-h-[44px]) stays in the wrapper via [&_button]: selectors so the component itself is layout-agnostic. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
19 lines
558 B
Svelte
19 lines
558 B
Svelte
<script lang="ts">
|
|
import { setLocale, getLocale } from '$lib/paraglide/runtime';
|
|
|
|
const locales = ['DE', 'EN', 'ES'] as const;
|
|
const localeMap = { DE: 'de', EN: 'en', ES: 'es' } as const;
|
|
const activeLocale = $derived(getLocale().toUpperCase());
|
|
</script>
|
|
|
|
{#each locales as locale (locale)}
|
|
<button
|
|
type="button"
|
|
onclick={() => setLocale(localeMap[locale])}
|
|
class="font-sans tracking-widest transition-colors
|
|
{activeLocale === locale ? 'font-bold text-ink' : 'font-normal text-ink-3 hover:text-ink'}"
|
|
>
|
|
{locale}
|
|
</button>
|
|
{/each}
|