diff --git a/i18n/en-US/locale.json b/i18n/en-US/locale.json new file mode 100644 index 0000000..db3878b --- /dev/null +++ b/i18n/en-US/locale.json @@ -0,0 +1,4 @@ +{ + "preferences": "Locale Preferences", + "language": "Language" +} diff --git a/i18n/en-US/locale_switch.json b/i18n/en-US/locale_switch.json deleted file mode 100644 index 35ea39a..0000000 --- a/i18n/en-US/locale_switch.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "label": "Change Language" -} diff --git a/i18n/en-US/theme_switch.json b/i18n/en-US/theme_switch.json deleted file mode 100644 index f1d0f44..0000000 --- a/i18n/en-US/theme_switch.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "label": "Change Theme", - "system": "System", - "light": "Light", - "dark": "Dark" -} diff --git a/src/lib/shared/i18n/LocaleSwitch.svelte b/src/lib/shared/i18n/LocaleSwitch.svelte deleted file mode 100644 index 25cc1c6..0000000 --- a/src/lib/shared/i18n/LocaleSwitch.svelte +++ /dev/null @@ -1,33 +0,0 @@ - - - diff --git a/src/lib/shared/i18n/index.ts b/src/lib/shared/i18n/index.ts index 8c42b4a..a712a84 100644 --- a/src/lib/shared/i18n/index.ts +++ b/src/lib/shared/i18n/index.ts @@ -18,7 +18,7 @@ const logger = getLogger('i18n'); function createLocalePreference() { const { subscribe, set } = persistCookie( - writable(sourceLanguageTag), + writable(sourceLanguageTag), 'i18n-locale' ); @@ -26,9 +26,6 @@ function createLocalePreference() { if (v) { setLanguageTag(v); } - if (v === undefined) { - setLanguageTag(sourceLanguageTag); - } }); return { diff --git a/src/lib/shared/layout/header/Header.svelte b/src/lib/shared/layout/header/Header.svelte index 378d2a2..400e446 100644 --- a/src/lib/shared/layout/header/Header.svelte +++ b/src/lib/shared/layout/header/Header.svelte @@ -1,18 +1,18 @@ @@ -40,10 +40,12 @@ {/if} - - - + (preferencesOpen = true)}> + + - + + + diff --git a/src/lib/shared/layout/header/MobileNavigation.svelte b/src/lib/shared/layout/header/MobileNavigation.svelte index 93e8640..e83dded 100644 --- a/src/lib/shared/layout/header/MobileNavigation.svelte +++ b/src/lib/shared/layout/header/MobileNavigation.svelte @@ -1,14 +1,11 @@ - - - - - - - - - - {m.theme_preferences()} - - - - - - - diff --git a/src/lib/shared/layout/preferences/LocalePreferencesSection.svelte b/src/lib/shared/layout/preferences/LocalePreferencesSection.svelte new file mode 100644 index 0000000..2a61830 --- /dev/null +++ b/src/lib/shared/layout/preferences/LocalePreferencesSection.svelte @@ -0,0 +1,63 @@ + + + + + {m.locale_language()} + + + + + + {getLanguageName(languageTag())} + + + + + {#each availableLanguageTags as language} + + + {getLanguageName(language)} + + {/each} + + + + + diff --git a/src/lib/shared/layout/preferences/PreferencesSheet.svelte b/src/lib/shared/layout/preferences/PreferencesSheet.svelte new file mode 100644 index 0000000..905af34 --- /dev/null +++ b/src/lib/shared/layout/preferences/PreferencesSheet.svelte @@ -0,0 +1,36 @@ + + + + + + + {m.locale_preferences()} + + + + + + + + + + {m.theme_preferences()} + + + + + + + + diff --git a/src/lib/shared/theme/ThemeSwitch.svelte b/src/lib/shared/layout/preferences/ThemePreferencesSection.svelte similarity index 100% rename from src/lib/shared/theme/ThemeSwitch.svelte rename to src/lib/shared/layout/preferences/ThemePreferencesSection.svelte