mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-06-01 09:19:49 +08:00
✨ Feature: add i18n for en
This commit is contained in:
@@ -27,7 +27,8 @@ import {
|
||||
OPEN_URL,
|
||||
RELOAD_APP,
|
||||
SHOW_PLUGIN_PAGE_MENU,
|
||||
SET_MINI_WINDOW_POS
|
||||
SET_MINI_WINDOW_POS,
|
||||
CHANGE_LANGUAGE
|
||||
} from '#/events/constants'
|
||||
import {
|
||||
uploadClipboardFiles,
|
||||
@@ -37,7 +38,7 @@ import picgoCoreIPC from './picgoCoreIPC'
|
||||
import { handleCopyUrl } from '~/main/utils/common'
|
||||
import { buildMainPageMenu, buildMiniPageMenu, buildPluginPageMenu, buildUploadPageMenu } from './remotes/menu'
|
||||
import path from 'path'
|
||||
import { T } from '~/universal/i18n'
|
||||
import { i18n, T } from '~/universal/i18n'
|
||||
|
||||
const STORE_PATH = app.getPath('userData')
|
||||
|
||||
@@ -223,6 +224,10 @@ export default {
|
||||
const window = BrowserWindow.getFocusedWindow()
|
||||
window?.setBounds(pos)
|
||||
})
|
||||
ipcMain.on(CHANGE_LANGUAGE, (evt: IpcMainEvent, lang: string) => {
|
||||
lang = lang || 'zh-CN'
|
||||
i18n.setLanguage(lang)
|
||||
})
|
||||
},
|
||||
dispose () {}
|
||||
}
|
||||
|
||||
@@ -81,9 +81,11 @@ const getPluginList = (): IPicGoPlugin[] => {
|
||||
const pluginPKG = requireFunc(path.join(pluginPath, 'package.json'))
|
||||
const uploaderName = plugin.uploader || ''
|
||||
const transformerName = plugin.transformer || ''
|
||||
let menu: IGuiMenuItem[] = []
|
||||
let menu: Omit<IGuiMenuItem, 'handle'>[] = []
|
||||
if (plugin.guiMenu) {
|
||||
menu = plugin.guiMenu(picgo)
|
||||
menu = plugin.guiMenu(picgo).map(item => ({
|
||||
label: item.label
|
||||
}))
|
||||
}
|
||||
let gui = false
|
||||
if (pluginPKG.keywords && pluginPKG.keywords.length > 0) {
|
||||
@@ -127,6 +129,8 @@ const getPluginList = (): IPicGoPlugin[] => {
|
||||
const handleGetPluginList = () => {
|
||||
ipcMain.on('getPluginList', (event: IpcMainEvent) => {
|
||||
const list = getPluginList()
|
||||
// here can just send JS Object not function
|
||||
// or will cause [Failed to serialize arguments] error
|
||||
event.sender.send('pluginList', list)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user