mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-27 19:20:24 +08:00
✨ Feature: add i18n for en
This commit is contained in:
10
src/renderer/utils/beforeOpen.ts
Normal file
10
src/renderer/utils/beforeOpen.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { i18n } from '~/universal/i18n'
|
||||
|
||||
export const handleURLParams = () => {
|
||||
const url = new URL(location.href)
|
||||
const search = new URLSearchParams(url.search)
|
||||
if (search.has('lang')) {
|
||||
const lang = search.get('lang') || 'zh-CN'
|
||||
i18n.setLanguage(lang)
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,15 @@
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import { ipcRenderer, IpcRendererEvent } from 'electron'
|
||||
import { PICGO_SAVE_CONFIG, PICGO_GET_CONFIG } from '#/events/constants'
|
||||
import { PICGO_SAVE_CONFIG, PICGO_GET_CONFIG, FORCE_UPDATE } from '#/events/constants'
|
||||
import { uuid } from 'uuidv4'
|
||||
@Component
|
||||
export default class extends Vue {
|
||||
created () {
|
||||
this.$bus.$on(FORCE_UPDATE, () => {
|
||||
this.$forceUpdate()
|
||||
})
|
||||
}
|
||||
|
||||
// support string key + value or object config
|
||||
saveConfig (config: IObj | string, value?: any) {
|
||||
if (typeof config === 'string') {
|
||||
@@ -27,4 +33,8 @@ export default class extends Vue {
|
||||
ipcRenderer.send(PICGO_GET_CONFIG, key, callbackId)
|
||||
})
|
||||
}
|
||||
|
||||
forceUpdate () {
|
||||
this.$bus.$emit(FORCE_UPDATE)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user