Skip to content

Commit

Permalink
feat: add more languages, fix DE flag discoloration, sml-versions red…
Browse files Browse the repository at this point in the history
…irect (#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
  • Loading branch information
budak7273 authored Oct 12, 2024
1 parent 0fe6243 commit 8a6afe6
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
37 changes: 32 additions & 5 deletions src/lib/components/general/TranslationDropdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, language> = {
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: '🇱🇻'
Expand All @@ -37,6 +59,10 @@
name: 'Nederlands',
flag: '🇳🇱'
},
'pt-BR': {
name: 'Português (Brasil)',
flag: '🇧🇷'
},
pl: {
name: 'Polski',
flag: '🇵🇱'
Expand All @@ -54,6 +80,7 @@
flag: '🇹🇼'
}
} as const;
// cspell:enable
const lang = writable<string>((browser && localStorage.getItem('language')) || $tolgee.getLanguage());
lang.subscribe((l) => {
Expand All @@ -73,17 +100,17 @@

<button class="variant-ghost-primary btn btn-sm grid grid-flow-col" use:popup={languageMenuBox}>
<span>{languages[$lang].name}</span>
<span class="text-xl">{languages[$lang].flag}</span>
<span class={`text-xl ${languages[$lang]?.style ?? defaultFlagTextStyle}`}>{languages[$lang].flag}</span>
</button>

<div class="card w-48 py-2 shadow-xl" data-popup="languageMenuBox">
<div class="card w-56 overflow-y-auto scroll-smooth py-2 shadow-xl" data-popup="languageMenuBox">
<nav class="list-nav">
<ul>
{#each Object.entries(languages) as [k, v]}
<li class:bg-primary-active-token={$lang === k}>
<button class="w-full" on:click={() => lang.set(k)}>
<span>{v.name}</span>
<span class="text-xl text-white">{v.flag}</span>
<span class="text-xl {v?.style ?? defaultFlagTextStyle}">{v.flag}</span>
</button>
</li>
{/each}
Expand Down
4 changes: 2 additions & 2 deletions src/routes/community/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
<p>
<T
keyName="community.welcome.description"
defaultValue="Welcome to the Satisfactory Modding comunity! Click here for a guide to help you get started playing with
mods." />
defaultValue="Welcome to the Satisfactory Modding community! Click here for a guide to help you get started playing with
mods. Currently only available in English." />
</p>
<LinkButton
url="https://docs.ficsit.app/satisfactory-modding/latest/ForUsers/Welcome.html"
Expand Down
6 changes: 6 additions & 0 deletions src/routes/sml-versions/+page.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { redirect } from '@sveltejs/kit';

// SML as a mod migration for 1.0 release
export function load() {
redirect(302, '/mod/SML');
}

0 comments on commit 8a6afe6

Please sign in to comment.