From 41fe99652ac442a2c857b6c71c76162531a8c4d5 Mon Sep 17 00:00:00 2001 From: James Xylight Date: Wed, 27 Aug 2025 17:22:23 -0700 Subject: [PATCH] i18n: add unofficial languages support --- src/lib/i18n/en.json | 12 ----- src/lib/i18n/translations.ts | 5 ++ src/lib/mono/forms/select/Option.svelte | 2 +- src/routes/settings/+layout.svelte | 5 +- src/routes/settings/app/+page.svelte | 72 ++++++++++++------------- 5 files changed, 46 insertions(+), 50 deletions(-) diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json index 82e026e4..44d90bd0 100644 --- a/src/lib/i18n/en.json +++ b/src/lib/i18n/en.json @@ -744,18 +744,6 @@ "lang": { "title": "Language", "description": "The language used for text in the UI.", - "note": "Languages other than English and Hebrew are community translated, and may be incomplete.", - "en": "English", - "en-US": "English", - "he": "Hebrew", - "et": "Estonian", - "fr": "French", - "de": "German", - "fi": "Finnish", - "pt": "Portuguese", - "zh": "Chinese", - "zh-Hans": "Chinese (Simplified)", - "zh-Hant": "Chinese (Traditional)", "auto": "Auto", "credits": "Credits", "useRtl": { diff --git a/src/lib/i18n/translations.ts b/src/lib/i18n/translations.ts index 8bfbd2b0..33a30e55 100644 --- a/src/lib/i18n/translations.ts +++ b/src/lib/i18n/translations.ts @@ -97,6 +97,11 @@ const config: Config = { key: '', loader: async () => (await import('./zh-Hant.json')).default, }, + { + locale: 'tok', + key: '', + loader: async () => (await import('./tok.json')).default, + }, ], fallbackLocale: 'en', } diff --git a/src/lib/mono/forms/select/Option.svelte b/src/lib/mono/forms/select/Option.svelte index 896c4b07..efaaa86b 100644 --- a/src/lib/mono/forms/select/Option.svelte +++ b/src/lib/mono/forms/select/Option.svelte @@ -15,7 +15,7 @@ label: optionElement?.innerText?.trim() ?? '', icon: icon, disabled: optionElement?.disabled, - isLabel: optionElement?.getAttribute('data-label') != null, + isLabel: optionElement?.getAttribute('data-label') == 'true', }) interface SelectContext { diff --git a/src/routes/settings/+layout.svelte b/src/routes/settings/+layout.svelte index 4fbfc0b1..32404ae0 100644 --- a/src/routes/settings/+layout.svelte +++ b/src/routes/settings/+layout.svelte @@ -13,7 +13,6 @@ } from 'svelte-hero-icons' let { children } = $props() - let importing = $state(false) let importText = $state('') @@ -44,6 +43,10 @@ {/if} + + {$t('settings.title')} + +
{$t('settings.title')} {#snippet extended()} diff --git a/src/routes/settings/app/+page.svelte b/src/routes/settings/app/+page.svelte index 349e4435..c4a59792 100644 --- a/src/routes/settings/app/+page.svelte +++ b/src/routes/settings/app/+page.svelte @@ -1,8 +1,13 @@ @@ -109,14 +110,13 @@ - {#each $locales as locale (locale)} - {@const mapped = localeMap.get(locale) ?? { - flag: '', - translated: 1, - name: locale, - }} - {/each}