pref: add locale auto switch for components of naive ui

This commit is contained in:
tiny-craft 2023-08-28 11:56:51 +08:00
parent 30346f7b73
commit df63381413
3 changed files with 13 additions and 2 deletions

View File

@ -59,6 +59,7 @@ watch(
:inline-theme-disabled="true"
:theme="prefStore.isDark ? darkTheme : undefined"
:theme-overrides="themeOverrides"
:locale="prefStore.themeLocale"
class="fill-height">
<n-global-style />
<n-dialog-provider>

View File

@ -64,7 +64,7 @@ defineExpose({
<n-form-item :label="$t('filter_keyword')">
<n-input v-model:value="data.keyword" clearable placeholder="" />
</n-form-item>
<n-form-item>
<n-form-item label="&nbsp;">
<icon-button :icon="Refresh" border t-tooltip="refresh" @click="loadHistory" />
</n-form-item>
</n-form>

View File

@ -10,7 +10,7 @@ import {
} from 'wailsjs/go/services/preferencesService.js'
import { BrowserOpenURL } from 'wailsjs/runtime/runtime.js'
import { i18nGlobal } from '@/utils/i18n.js'
import { useOsTheme } from 'naive-ui'
import { zhCN, enUS, useOsTheme } from 'naive-ui'
const osTheme = useOsTheme()
const usePreferencesStore = defineStore('preferences', {
@ -142,6 +142,16 @@ const usePreferencesStore = defineStore('preferences', {
}
},
themeLocale() {
const lang = this.currentLanguage
switch (lang) {
case 'zh':
return zhCN
default:
return enUS
}
},
autoCheckUpdate() {
return get(this.general, 'checkUpdate', false)
},