Skip to content

Commit adcef7d

Browse files
authored
Add locale setting (#708)
1 parent 8ba5da1 commit adcef7d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/App.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { StatusWsMessageStatus } from './types/apiTypes'
3333
import { useQueuePendingTaskCountStore } from './stores/queueStore'
3434
import type { ToastMessageOptions } from 'primevue/toast'
3535
import { useToast } from 'primevue/usetoast'
36+
import { i18n } from './i18n'
3637
3738
const isLoading = computed<boolean>(() => useWorkspaceStore().spinner)
3839
const theme = computed<string>(() =>
@@ -68,6 +69,13 @@ watchEffect(() => {
6869
)
6970
})
7071
72+
watchEffect(() => {
73+
const locale = useSettingStore().get('Comfy.Locale')
74+
if (locale) {
75+
i18n.global.locale.value = locale
76+
}
77+
})
78+
7179
const { t } = useI18n()
7280
const init = () => {
7381
useSettingStore().addSettings(app.ui.settings)

src/stores/settingStore.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,14 @@ export const useSettingStore = defineStore('setting', {
295295
step: 1
296296
}
297297
})
298+
299+
app.ui.settings.addSetting({
300+
id: 'Comfy.Locale',
301+
name: 'Locale',
302+
type: 'combo',
303+
options: ['en', 'zh'],
304+
defaultValue: navigator.language.split('-')[0] || 'en'
305+
})
298306
},
299307

300308
set<K extends keyof Settings>(key: K, value: Settings[K]) {

0 commit comments

Comments
 (0)