From 8a6afe6ef3dd29be0039706de30b9d74e868a6bc Mon Sep 17 00:00:00 2001 From: Rob B Date: Sat, 12 Oct 2024 15:45:00 -0400 Subject: [PATCH] feat: add more languages, fix DE flag discoloration, sml-versions redirect (#200) * fix: language flag icons showing with incorrect colors (ex. germany white instead of black) * feat: add es, hu, ko, pt-BR, to language picker. widen dropdown, setup overflow scrolling * fix: typo * feat: redirect old /sml-versions page to /mod/SML --- cspell.json | 2 +- .../general/TranslationDropdown.svelte | 37 ++++++++++++++++--- src/routes/community/+page.svelte | 4 +- src/routes/sml-versions/+page.server.ts | 6 +++ 4 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 src/routes/sml-versions/+page.server.ts diff --git a/cspell.json b/cspell.json index f7c147f40..8440acdc2 100644 --- a/cspell.json +++ b/cspell.json @@ -25,5 +25,5 @@ // flagWords - list of words to be always considered incorrect // This is useful for offensive words and common spelling errors. // cSpell:disable (don't complain about the words we listed here) - "flagWords": ["hte"] + "flagWords": ["hte", "comunity"] } diff --git a/src/lib/components/general/TranslationDropdown.svelte b/src/lib/components/general/TranslationDropdown.svelte index ddcfb5c67..15c8225e3 100644 --- a/src/lib/components/general/TranslationDropdown.svelte +++ b/src/lib/components/general/TranslationDropdown.svelte @@ -8,23 +8,45 @@ export const { t } = getTranslate(); - const languages = { + type language = { + name: string; + flag: string; + style?: string; + }; + + const defaultFlagTextStyle = 'text-white'; + + // cspell:disable + const languages: Record = { en: { name: 'English', flag: '🇺🇳' }, de: { name: 'Deutsch', - flag: '🇩🇪' + flag: '🇩🇪', + style: 'text-black' // Bug in something? text color affects the top stripe of the DE flag + }, + es: { + name: 'Español', + flag: '🇪🇸' }, fr: { name: 'Français', flag: '🇫🇷' }, + hu: { + name: 'Magyar', + flag: '🇭🇺' + }, it: { name: 'Italiano', flag: '🇮🇹' }, + ko: { + name: '한국어', + flag: '🇰🇷' + }, lv: { name: 'Latviešu', flag: '🇱🇻' @@ -37,6 +59,10 @@ name: 'Nederlands', flag: '🇳🇱' }, + 'pt-BR': { + name: 'Português (Brasil)', + flag: '🇧🇷' + }, pl: { name: 'Polski', flag: '🇵🇱' @@ -54,6 +80,7 @@ flag: '🇹🇼' } } as const; + // cspell:enable const lang = writable((browser && localStorage.getItem('language')) || $tolgee.getLanguage()); lang.subscribe((l) => { @@ -73,17 +100,17 @@ -
+