Feature: add i18n for en

This commit is contained in:
PiEgg
2022-02-20 21:30:22 +08:00
parent 7f6d58f992
commit 1936ccfedc
15 changed files with 333 additions and 19 deletions

View 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)
}
}

View File

@@ -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)
}
}