From 8937a8eba9cd203a179dbd3ff8c11c1e50034b0c Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Sun, 26 Dec 2021 19:50:24 +0200 Subject: [PATCH] Added svelte components - made `SelectionBox` component - made `DXVKSelectionList` component - updated locales files - added locale selection based on `SelectionBox` component --- README.md | 4 +- public/locales/en-us.yaml | 12 ++-- public/locales/ru-ru.yaml | 16 +++-- src/components/Checkbox.vue | 38 ----------- src/components/DXVKItem.vue | 9 --- src/components/DXVKSelectionList.svelte | 36 ++++++++++ src/components/DXVKs.vue | 10 --- src/components/SelectionBox.svelte | 66 +++++++++++++++++++ src/components/bases/SelectionList.vue | 13 ---- src/components/bases/SelectionListItem.vue | 19 ------ src/sass/components.sass | 2 + .../{selectbox.sass => selectionBox.sass} | 0 src/settings.svelte | 25 ++++--- 13 files changed, 139 insertions(+), 111 deletions(-) delete mode 100644 src/components/Checkbox.vue delete mode 100644 src/components/DXVKItem.vue create mode 100644 src/components/DXVKSelectionList.svelte delete mode 100644 src/components/DXVKs.vue create mode 100644 src/components/SelectionBox.svelte delete mode 100644 src/components/bases/SelectionList.vue delete mode 100644 src/components/bases/SelectionListItem.vue rename src/sass/components/{selectbox.sass => selectionBox.sass} (100%) diff --git a/README.md b/README.md index 6508aca..18e8842 100644 --- a/README.md +++ b/README.md @@ -148,14 +148,14 @@ This is our current roadmap goals. You can find older ones [here](ROADMAP.md) * Voice data update (installation) required * Patch unavailable * Test patch available -* Make Vue components +* Make Svelte components * Checkbox * Selectbox * SelectionList * SelectableCheckbox * PropertiesEditor * Rewrite sass code, provide more flexible theming ability -* Add `vue-i18n` +* Add `svelte-i18n` ### Features diff --git a/public/locales/en-us.yaml b/public/locales/en-us.yaml index 36a98d1..ccfccbc 100644 --- a/public/locales/en-us.yaml +++ b/public/locales/en-us.yaml @@ -3,10 +3,12 @@ settings: general: title: General items: - test1: Hello 1 - test2: Hello 2 - test3: Hello 3 - # Language selection lang: - launcher: Language \ No newline at end of file + launcher: + title: Launcher + items: + en-us: English (US) + ru-ru: Русский + + dxvks: DXVK \ No newline at end of file diff --git a/public/locales/ru-ru.yaml b/public/locales/ru-ru.yaml index 9b07eb0..1618147 100644 --- a/public/locales/ru-ru.yaml +++ b/public/locales/ru-ru.yaml @@ -1,12 +1,14 @@ settings: - # General + # Основное general: title: Основное items: - test1: Привет 1 - test2: Привет 2 - test3: Привет 3 - - # Language selection + # Выбор языка lang: - launcher: Язык \ No newline at end of file + launcher: + title: Лаунчер + items: + en-us: English (US) + ru-ru: Русский + + dxvks: DXVK \ No newline at end of file diff --git a/src/components/Checkbox.vue b/src/components/Checkbox.vue deleted file mode 100644 index fe0e77f..0000000 --- a/src/components/Checkbox.vue +++ /dev/null @@ -1,38 +0,0 @@ - - - - - diff --git a/src/components/DXVKItem.vue b/src/components/DXVKItem.vue deleted file mode 100644 index 1d2afe6..0000000 --- a/src/components/DXVKItem.vue +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/src/components/DXVKSelectionList.svelte b/src/components/DXVKSelectionList.svelte new file mode 100644 index 0000000..557e168 --- /dev/null +++ b/src/components/DXVKSelectionList.svelte @@ -0,0 +1,36 @@ + + +

{ $_('settings.general.items.dxvks') }

+ +
+ {#each dxvks as dxvk} +
+ { dxvk.version } + +
+ + + + + + + +
+
+ {/each} +
diff --git a/src/components/DXVKs.vue b/src/components/DXVKs.vue deleted file mode 100644 index ca72628..0000000 --- a/src/components/DXVKs.vue +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/src/components/SelectionBox.svelte b/src/components/SelectionBox.svelte new file mode 100644 index 0000000..75fd701 --- /dev/null +++ b/src/components/SelectionBox.svelte @@ -0,0 +1,66 @@ + + +
+ { $_(lang) } + +
+
    + {#each Object.keys(items) as itemLang} +
  • { + selectedValue = itemLang; + + valueChanged(selectedValue); + }} + + class:selected={itemLang === selectedValue} + >{ $_(items[itemLang]) }
  • + {/each} +
+
+ +
selectionOpen = !selectionOpen}> + { $_(items[selectedValue]) } + + + +
+
diff --git a/src/components/bases/SelectionList.vue b/src/components/bases/SelectionList.vue deleted file mode 100644 index 513b00a..0000000 --- a/src/components/bases/SelectionList.vue +++ /dev/null @@ -1,13 +0,0 @@ - - - - - diff --git a/src/components/bases/SelectionListItem.vue b/src/components/bases/SelectionListItem.vue deleted file mode 100644 index fc6d7ba..0000000 --- a/src/components/bases/SelectionListItem.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - diff --git a/src/sass/components.sass b/src/sass/components.sass index df03813..66909fa 100644 --- a/src/sass/components.sass +++ b/src/sass/components.sass @@ -1,6 +1,8 @@ @use "sass:map" @import "components/checkbox" +@import "components/selectionBox" +@import "components/selectionList" @mixin themable($theme-name, $theme-map) body[data-theme=#{$theme-name}] diff --git a/src/sass/components/selectbox.sass b/src/sass/components/selectionBox.sass similarity index 100% rename from src/sass/components/selectbox.sass rename to src/sass/components/selectionBox.sass diff --git a/src/settings.svelte b/src/settings.svelte index 5be435a..49a6456 100644 --- a/src/settings.svelte +++ b/src/settings.svelte @@ -3,6 +3,16 @@ import { _, locale, locales } from 'svelte-i18n'; import Checkbox from './components/Checkbox.svelte'; + import SelectionBox from './components/SelectionBox.svelte'; + import DXVKSelectionList from './components/DXVKSelectionList.svelte'; + + let availableLocales: ArrayLike = []; + + $locales.forEach((locale) => { + availableLocales[locale] = `settings.general.items.lang.launcher.items.${locale}`; + }); + + availableLocales = availableLocales; import Window from './ts/neutralino/Window'; @@ -21,15 +31,14 @@

{$_('settings.general.title')}

- - - + $locale = value} + /> - +
{/if}