diff --git a/src/App.vue b/src/App.vue index d29169b..7e58ff8 100644 --- a/src/App.vue +++ b/src/App.vue @@ -11,15 +11,18 @@ import MainContainer from './components/App/MainContainer.vue'; import { onMounted } from 'vue'; import { useApiStore } from './stores/api.store'; import { useGlobalStore } from './stores/global.store'; +import { useI18n } from 'vue-i18n'; const originalDocumentTitle = document.title; const apiStore = useApiStore(); const globalStore = useGlobalStore(); +const i18n = useI18n(); onMounted(() => { apiStore.setupAPIData(); + setupLocale(); setupDarkMode(); loadStorageTimetables(); setupAfterPrintClose(); @@ -45,4 +48,14 @@ function setupAfterPrintClose() { document.title = originalDocumentTitle; }); } + +function setupLocale() { + if (window.localStorage.getItem('locale') == null) { + const browserLang = window.navigator.language; + if (browserLang == 'pl-PL') i18n.locale.value = browserLang == 'pl-PL' ? 'pl' : 'en'; + window.localStorage.setItem('locale', i18n.locale.value); + } else { + i18n.locale.value = window.localStorage.getItem('locale')!; + } +} diff --git a/src/components/App/Navbar.vue b/src/components/App/Navbar.vue index 36ac27f..275e37e 100644 --- a/src/components/App/Navbar.vue +++ b/src/components/App/Navbar.vue @@ -1,18 +1,31 @@ diff --git a/src/components/App/SettingsCard.vue b/src/components/App/SettingsCard.vue new file mode 100644 index 0000000..430b7bb --- /dev/null +++ b/src/components/App/SettingsCard.vue @@ -0,0 +1,42 @@ + + + + + diff --git a/src/components/Timetable/TimetableSelect.vue b/src/components/Timetable/TimetableSelect.vue index ea35cc3..2b142ac 100644 --- a/src/components/Timetable/TimetableSelect.vue +++ b/src/components/Timetable/TimetableSelect.vue @@ -32,7 +32,7 @@ type="text" v-if="globalStore.viewMode == 'storage'" class="bg-zinc-800 p-1 rounded-md print:hidden w-full" - :placeholder="$t('train-select-placeholder')" + :placeholder="$t('train-search-placeholder')" />