Implement localization

This commit is contained in:
2025-01-12 00:17:19 +01:00
parent 2788afe822
commit d43e961184
16 changed files with 621 additions and 31 deletions

View File

@@ -0,0 +1,26 @@
<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>