<script lang="ts">
    import { locale, isLoading } from 'svelte-i18n';
    import { GetLocale, SetLocale } from '$wails/main/App';

    const languages = [
        { code: 'en', name: 'EN' },
        { code: 'ru', name: 'RU' }
    ];

    async function setLanguage(lang: string) {
        $locale = lang;
        await SetLocale(lang);
    }
</script>

<div class="flex gap-1">
    {#each languages as lang}
        <button
            class="px-3 py-1 rounded-lg transition-colors {$locale === lang.code ? 'bg-blue-500 text-white' : 'bg-gray-800 text-gray-300 hover:bg-gray-700'}"
            on:click={() => setLanguage(lang.code)}
            disabled={$isLoading}
        >
            {lang.name}
        </button>
    {/each}
</div> 