<script> import { locale } from "svelte-i18n"; import { supportedLocales } from "$lib/i18n"; </script> <div class="language-switcher"> <select value={$locale} on:change={(e) => { locale.set(e.target.value); if (typeof localStorage !== "undefined") { localStorage.setItem("preferredLocale", e.target.value); } }} class="bg-transparent border border-gray-300 rounded px-2 py-1 text-sm"> {#each supportedLocales as loc} <option value={loc.id}>{loc.name}</option> {/each} </select> </div> <style> .language-switcher { display: inline-block; } </style>
