feat: update electron configuration and add locale-based language selection #370
This commit is contained in:
parent
ec703852f8
commit
9288e7b292
@ -21,6 +21,9 @@ export default defineConfig({
|
||||
'@renderer': resolve('src/renderer/src')
|
||||
}
|
||||
},
|
||||
plugins: [react()]
|
||||
plugins: [react()],
|
||||
optimizeDeps: {
|
||||
exclude: ['chunk-KNVOMWSO.js']
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -2,6 +2,8 @@ import { LanguageVarious, ThemeMode } from '@types'
|
||||
import { app } from 'electron'
|
||||
import Store from 'electron-store'
|
||||
|
||||
import { locales } from '../utils/locales'
|
||||
|
||||
export class ConfigManager {
|
||||
private store: Store
|
||||
private subscribers: Map<string, Array<(newValue: any) => void>> = new Map()
|
||||
@ -11,7 +13,8 @@ export class ConfigManager {
|
||||
}
|
||||
|
||||
getLanguage(): LanguageVarious {
|
||||
return this.store.get('language', app.getLocale()) as LanguageVarious
|
||||
const locale = Object.keys(locales).includes(app.getLocale()) ? app.getLocale() : 'en-US'
|
||||
return this.store.get('language', locale) as LanguageVarious
|
||||
}
|
||||
|
||||
setLanguage(theme: LanguageVarious) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user