mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-08 21:38:13 -05:00
🚧 WIP: main process i18n
This commit is contained in:
parent
c2991dde2f
commit
c19f741243
@ -215,7 +215,7 @@ export function createTray () {
|
|||||||
for (let i = 0; i < imgs.length; i++) {
|
for (let i = 0; i < imgs.length; i++) {
|
||||||
pasteText.push(pasteTemplate(pasteStyle, imgs[i], db.get('settings.customLink')))
|
pasteText.push(pasteTemplate(pasteStyle, imgs[i], db.get('settings.customLink')))
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
title: T('UPLOAD_SUCCESSFULLY'),
|
title: T('UPLOAD_SUCCEED'),
|
||||||
body: imgs[i].imgUrl!,
|
body: imgs[i].imgUrl!,
|
||||||
icon: files[i]
|
icon: files[i]
|
||||||
})
|
})
|
||||||
|
@ -9,6 +9,7 @@ import pasteTemplate from '~/main/utils/pasteTemplate'
|
|||||||
import db, { GalleryDB } from '~/main/apis/core/datastore'
|
import db, { GalleryDB } from '~/main/apis/core/datastore'
|
||||||
import { handleCopyUrl } from '~/main/utils/common'
|
import { handleCopyUrl } from '~/main/utils/common'
|
||||||
import { handleUrlEncode } from '#/utils/common'
|
import { handleUrlEncode } from '#/utils/common'
|
||||||
|
import { T } from '#/i18n/index'
|
||||||
export const uploadClipboardFiles = async (): Promise<string> => {
|
export const uploadClipboardFiles = async (): Promise<string> => {
|
||||||
const win = windowManager.getAvailableWindow()
|
const win = windowManager.getAvailableWindow()
|
||||||
const img = await uploader.setWebContents(win!.webContents).upload()
|
const img = await uploader.setWebContents(win!.webContents).upload()
|
||||||
@ -18,7 +19,7 @@ export const uploadClipboardFiles = async (): Promise<string> => {
|
|||||||
const pasteStyle = db.get('settings.pasteStyle') || 'markdown'
|
const pasteStyle = db.get('settings.pasteStyle') || 'markdown'
|
||||||
handleCopyUrl(pasteTemplate(pasteStyle, img[0], db.get('settings.customLink')))
|
handleCopyUrl(pasteTemplate(pasteStyle, img[0], db.get('settings.customLink')))
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
title: '上传成功',
|
title: T('UPLOAD_SUCCEED'),
|
||||||
body: img[0].imgUrl!,
|
body: img[0].imgUrl!,
|
||||||
icon: img[0].imgUrl
|
icon: img[0].imgUrl
|
||||||
})
|
})
|
||||||
@ -33,8 +34,8 @@ export const uploadClipboardFiles = async (): Promise<string> => {
|
|||||||
return handleUrlEncode(img[0].imgUrl as string)
|
return handleUrlEncode(img[0].imgUrl as string)
|
||||||
} else {
|
} else {
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
title: '上传不成功',
|
title: T('UPLOAD_FAILED'),
|
||||||
body: '你剪贴板最新的一条记录不是图片哦'
|
body: T('TIPS_UPLOAD_NOT_PICTURES')
|
||||||
})
|
})
|
||||||
notification.show()
|
notification.show()
|
||||||
return ''
|
return ''
|
||||||
@ -54,7 +55,7 @@ export const uploadChoosedFiles = async (webContents: WebContents, files: IFileW
|
|||||||
for (let i = 0; i < imgs.length; i++) {
|
for (let i = 0; i < imgs.length; i++) {
|
||||||
pasteText.push(pasteTemplate(pasteStyle, imgs[i], db.get('settings.customLink')))
|
pasteText.push(pasteTemplate(pasteStyle, imgs[i], db.get('settings.customLink')))
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
title: '上传成功',
|
title: T('UPLOAD_SUCCEED'),
|
||||||
body: imgs[i].imgUrl!,
|
body: imgs[i].imgUrl!,
|
||||||
icon: files[i].path
|
icon: files[i].path
|
||||||
})
|
})
|
||||||
|
@ -14,6 +14,7 @@ import { IPicGo } from 'picgo'
|
|||||||
import { showNotification, calcDurationRange } from '~/main/utils/common'
|
import { showNotification, calcDurationRange } from '~/main/utils/common'
|
||||||
import { RENAME_FILE_NAME, TALKING_DATA_EVENT } from '~/universal/events/constants'
|
import { RENAME_FILE_NAME, TALKING_DATA_EVENT } from '~/universal/events/constants'
|
||||||
import logger from '@core/picgo/logger'
|
import logger from '@core/picgo/logger'
|
||||||
|
import { T } from '~/universal/i18n'
|
||||||
|
|
||||||
const waitForShow = (webcontent: WebContents) => {
|
const waitForShow = (webcontent: WebContents) => {
|
||||||
return new Promise<void>((resolve) => {
|
return new Promise<void>((resolve) => {
|
||||||
@ -71,8 +72,8 @@ class Uploader {
|
|||||||
picgo.on('beforeTransform', () => {
|
picgo.on('beforeTransform', () => {
|
||||||
if (db.get('settings.uploadNotification')) {
|
if (db.get('settings.uploadNotification')) {
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
title: '上传进度',
|
title: T('UPLOAD_PROGRESS'),
|
||||||
body: '正在上传'
|
body: T('UPLOADING')
|
||||||
})
|
})
|
||||||
notification.show()
|
notification.show()
|
||||||
}
|
}
|
||||||
@ -129,7 +130,7 @@ class Uploader {
|
|||||||
logger.error(e)
|
logger.error(e)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
showNotification({
|
showNotification({
|
||||||
title: '上传失败',
|
title: T('UPLOAD_FAILED'),
|
||||||
body: util.format(e.stack),
|
body: util.format(e.stack),
|
||||||
clickToCopy: true
|
clickToCopy: true
|
||||||
})
|
})
|
||||||
|
@ -3,6 +3,7 @@ import path from 'path'
|
|||||||
import { app as APP } from 'electron'
|
import { app as APP } from 'electron'
|
||||||
import { getLogger } from '@core/utils/localLogger'
|
import { getLogger } from '@core/utils/localLogger'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
|
import { T } from '~/universal/i18n'
|
||||||
const STORE_PATH = APP.getPath('userData')
|
const STORE_PATH = APP.getPath('userData')
|
||||||
const configFilePath = path.join(STORE_PATH, 'data.json')
|
const configFilePath = path.join(STORE_PATH, 'data.json')
|
||||||
const configFileBackupPath = path.join(STORE_PATH, 'data.bak.json')
|
const configFileBackupPath = path.join(STORE_PATH, 'data.bak.json')
|
||||||
@ -11,8 +12,8 @@ let _configFilePath = ''
|
|||||||
let hasCheckPath = false
|
let hasCheckPath = false
|
||||||
|
|
||||||
const errorMsg = {
|
const errorMsg = {
|
||||||
broken: 'PicGo 配置文件损坏,已经恢复为默认配置',
|
broken: T('TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_DEFAULT'),
|
||||||
brokenButBackup: 'PicGo 配置文件损坏,已经恢复为备份配置'
|
brokenButBackup: T('TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_BACKUP')
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ensure notification list */
|
/** ensure notification list */
|
||||||
@ -36,7 +37,7 @@ function dbChecker () {
|
|||||||
}
|
}
|
||||||
let configFile: string = '{}'
|
let configFile: string = '{}'
|
||||||
const optionsTpl = {
|
const optionsTpl = {
|
||||||
title: '注意',
|
title: T('TIPS_NOTICE'),
|
||||||
body: ''
|
body: ''
|
||||||
}
|
}
|
||||||
// config save bak
|
// config save bak
|
||||||
@ -51,7 +52,9 @@ function dbChecker () {
|
|||||||
JSON.parse(configFile)
|
JSON.parse(configFile)
|
||||||
fs.writeFileSync(configFilePath, configFile, { encoding: 'utf-8' })
|
fs.writeFileSync(configFilePath, configFile, { encoding: 'utf-8' })
|
||||||
const stats = fs.statSync(configFileBackupPath)
|
const stats = fs.statSync(configFileBackupPath)
|
||||||
optionsTpl.body = `${errorMsg.brokenButBackup}\n备份文件版本:${dayjs(stats.mtime).format('YYYY-MM-DD HH:mm:ss')}`
|
optionsTpl.body = `${errorMsg.brokenButBackup}\n${T('TIPS_PICGO_BACKUP_FILE_VERSION', {
|
||||||
|
v: dayjs(stats.mtime).format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
})}`
|
||||||
global.notificationList?.push(optionsTpl)
|
global.notificationList?.push(optionsTpl)
|
||||||
return
|
return
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -98,8 +101,8 @@ function dbPathChecker (): string {
|
|||||||
const logger = getLogger(picgoLogPath)
|
const logger = getLogger(picgoLogPath)
|
||||||
if (!hasCheckPath) {
|
if (!hasCheckPath) {
|
||||||
const optionsTpl = {
|
const optionsTpl = {
|
||||||
title: '注意',
|
title: T('TIPS_NOTICE'),
|
||||||
body: '自定义文件解析出错,请检查路径内容是否正确'
|
body: T('TIPS_CUSTOM_CONFIG_FILE_PATH_ERROR')
|
||||||
}
|
}
|
||||||
global.notificationList?.push(optionsTpl)
|
global.notificationList?.push(optionsTpl)
|
||||||
hasCheckPath = true
|
hasCheckPath = true
|
||||||
|
@ -5,6 +5,7 @@ import FileSync from 'lowdb/adapters/FileSync'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import { dbPathChecker, dbPathDir, getGalleryDBPath } from './dbChecker'
|
import { dbPathChecker, dbPathDir, getGalleryDBPath } from './dbChecker'
|
||||||
import { DBStore } from '@picgo/store'
|
import { DBStore } from '@picgo/store'
|
||||||
|
import { T } from '~/universal/i18n'
|
||||||
|
|
||||||
const STORE_PATH = dbPathDir()
|
const STORE_PATH = dbPathDir()
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ class ConfigStore {
|
|||||||
enable: true,
|
enable: true,
|
||||||
key: 'CommandOrControl+Shift+P',
|
key: 'CommandOrControl+Shift+P',
|
||||||
name: 'upload',
|
name: 'upload',
|
||||||
label: '快捷上传'
|
label: T('QUICK_UPLOAD')
|
||||||
}).write()
|
}).write()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import {
|
|||||||
SHOW_INPUT_BOX
|
SHOW_INPUT_BOX
|
||||||
} from '~/universal/events/constants'
|
} from '~/universal/events/constants'
|
||||||
import { DBStore } from '@picgo/store'
|
import { DBStore } from '@picgo/store'
|
||||||
|
import { T } from '~/universal/i18n'
|
||||||
|
|
||||||
// Cross-process support may be required in the future
|
// Cross-process support may be required in the future
|
||||||
class GuiApi implements IGuiApi {
|
class GuiApi implements IGuiApi {
|
||||||
@ -81,7 +82,7 @@ class GuiApi implements IGuiApi {
|
|||||||
for (let i = 0; i < imgs.length; i++) {
|
for (let i = 0; i < imgs.length; i++) {
|
||||||
pasteText.push(pasteTemplate(pasteStyle, imgs[i], db.get('settings.customLink')))
|
pasteText.push(pasteTemplate(pasteStyle, imgs[i], db.get('settings.customLink')))
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
title: '上传成功',
|
title: T('UPLOAD_SUCCEED'),
|
||||||
body: imgs[i].imgUrl as string,
|
body: imgs[i].imgUrl as string,
|
||||||
icon: imgs[i].imgUrl
|
icon: imgs[i].imgUrl
|
||||||
})
|
})
|
||||||
@ -151,8 +152,8 @@ class GuiApi implements IGuiApi {
|
|||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const guiApi = GuiApi.getInstance()
|
const guiApi = GuiApi.getInstance()
|
||||||
guiApi.showMessageBox({
|
guiApi.showMessageBox({
|
||||||
title: '警告',
|
title: T('TIPS_WARNING'),
|
||||||
message: '有插件正在试图删除一些相册图片,是否继续',
|
message: T('TIPS_PLUGIN_REMOVE_GALLERY_ITEM'),
|
||||||
type: 'info',
|
type: 'info',
|
||||||
buttons: ['Yes', 'No']
|
buttons: ['Yes', 'No']
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
@ -37,6 +37,7 @@ import picgoCoreIPC from './picgoCoreIPC'
|
|||||||
import { handleCopyUrl } from '~/main/utils/common'
|
import { handleCopyUrl } from '~/main/utils/common'
|
||||||
import { buildMainPageMenu, buildMiniPageMenu, buildPluginPageMenu, buildUploadPageMenu } from './remotes/menu'
|
import { buildMainPageMenu, buildMiniPageMenu, buildPluginPageMenu, buildUploadPageMenu } from './remotes/menu'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import { T } from '~/universal/i18n'
|
||||||
|
|
||||||
const STORE_PATH = app.getPath('userData')
|
const STORE_PATH = app.getPath('userData')
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ export default {
|
|||||||
const pasteStyle = db.get('settings.pasteStyle') || 'markdown'
|
const pasteStyle = db.get('settings.pasteStyle') || 'markdown'
|
||||||
handleCopyUrl(pasteTemplate(pasteStyle, img[0], db.get('settings.customLink')))
|
handleCopyUrl(pasteTemplate(pasteStyle, img[0], db.get('settings.customLink')))
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
title: '上传成功',
|
title: T('UPLOAD_SUCCEED'),
|
||||||
body: img[0].imgUrl!,
|
body: img[0].imgUrl!,
|
||||||
// icon: file[0]
|
// icon: file[0]
|
||||||
icon: img[0].imgUrl
|
icon: img[0].imgUrl
|
||||||
@ -79,14 +80,14 @@ export default {
|
|||||||
evt.sender.send('updateShortKeyResponse', result)
|
evt.sender.send('updateShortKeyResponse', result)
|
||||||
if (result) {
|
if (result) {
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
title: '操作成功',
|
title: T('OPERATION_SUCCEED'),
|
||||||
body: '你的快捷键已经修改成功'
|
body: T('TIPS_SHORTCUT_MODIFIED_SUCCEED')
|
||||||
})
|
})
|
||||||
notification.show()
|
notification.show()
|
||||||
} else {
|
} else {
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
title: '操作失败',
|
title: T('OPERATION_FAILED'),
|
||||||
body: '快捷键冲突,请重新设置'
|
body: T('TIPS_SHORTCUT_MODIFIED_CONFLICT')
|
||||||
})
|
})
|
||||||
notification.show()
|
notification.show()
|
||||||
}
|
}
|
||||||
@ -96,14 +97,14 @@ export default {
|
|||||||
const result = shortKeyHandler.bindOrUnbindShortKey(item, from)
|
const result = shortKeyHandler.bindOrUnbindShortKey(item, from)
|
||||||
if (result) {
|
if (result) {
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
title: '操作成功',
|
title: T('OPERATION_SUCCEED'),
|
||||||
body: '你的快捷键已经修改成功'
|
body: T('TIPS_SHORTCUT_MODIFIED_SUCCEED')
|
||||||
})
|
})
|
||||||
notification.show()
|
notification.show()
|
||||||
} else {
|
} else {
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
title: '操作失败',
|
title: T('OPERATION_FAILED'),
|
||||||
body: '快捷键冲突,请重新设置'
|
body: T('TIPS_SHORTCUT_MODIFIED_CONFLICT')
|
||||||
})
|
})
|
||||||
notification.show()
|
notification.show()
|
||||||
}
|
}
|
||||||
@ -111,8 +112,8 @@ export default {
|
|||||||
|
|
||||||
ipcMain.on('updateCustomLink', () => {
|
ipcMain.on('updateCustomLink', () => {
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
title: '操作成功',
|
title: T('OPERATION_SUCCEED'),
|
||||||
body: '你的自定义链接格式已经修改成功'
|
body: T('TIPS_CUSTOM_LINK_STYLE_MODIFIED_SUCCEED')
|
||||||
})
|
})
|
||||||
notification.show()
|
notification.show()
|
||||||
})
|
})
|
||||||
|
@ -31,6 +31,7 @@ import {
|
|||||||
import { GalleryDB } from 'apis/core/datastore'
|
import { GalleryDB } from 'apis/core/datastore'
|
||||||
import { IObject, IFilter } from '@picgo/store/dist/types'
|
import { IObject, IFilter } from '@picgo/store/dist/types'
|
||||||
import pasteTemplate from '../utils/pasteTemplate'
|
import pasteTemplate from '../utils/pasteTemplate'
|
||||||
|
import { T } from '~/universal/i18n'
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
const requireFunc = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require
|
const requireFunc = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require
|
||||||
@ -143,7 +144,7 @@ const handlePluginInstall = () => {
|
|||||||
shortKeyHandler.registerPluginShortKey(res.body[0])
|
shortKeyHandler.registerPluginShortKey(res.body[0])
|
||||||
} else {
|
} else {
|
||||||
showNotification({
|
showNotification({
|
||||||
title: '插件安装失败',
|
title: T('PLUGIN_INSTALL_FAILED'),
|
||||||
body: res.body as string
|
body: res.body as string
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -161,7 +162,7 @@ const handlePluginUninstall = async (fullName: string) => {
|
|||||||
shortKeyHandler.unregisterPluginShortKey(res.body[0])
|
shortKeyHandler.unregisterPluginShortKey(res.body[0])
|
||||||
} else {
|
} else {
|
||||||
showNotification({
|
showNotification({
|
||||||
title: '插件卸载失败',
|
title: T('PLUGIN_UNINSTALL_FAILED'),
|
||||||
body: res.body as string
|
body: res.body as string
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -177,7 +178,7 @@ const handlePluginUpdate = async (fullName: string) => {
|
|||||||
window.webContents.send('updateSuccess', res.body[0])
|
window.webContents.send('updateSuccess', res.body[0])
|
||||||
} else {
|
} else {
|
||||||
showNotification({
|
showNotification({
|
||||||
title: '插件更新失败',
|
title: T('PLUGIN_UPDATE_FAILED'),
|
||||||
body: res.body as string
|
body: res.body as string
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -189,8 +190,8 @@ const handleNPMError = (): IDispose => {
|
|||||||
const handler = (msg: string) => {
|
const handler = (msg: string) => {
|
||||||
if (msg === 'NPM is not installed') {
|
if (msg === 'NPM is not installed') {
|
||||||
dialog.showMessageBox({
|
dialog.showMessageBox({
|
||||||
title: '发生错误',
|
title: T('TIPS_ERROR'),
|
||||||
message: '请安装Node.js并重启PicGo再继续操作',
|
message: T('TIPS_INSTALL_NODE_AND_RELOAD_PICGO'),
|
||||||
buttons: ['Yes']
|
buttons: ['Yes']
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.response === 0) {
|
if (res.response === 0) {
|
||||||
@ -265,12 +266,12 @@ const handleImportLocalPlugin = () => {
|
|||||||
const list = getPluginList()
|
const list = getPluginList()
|
||||||
event.sender.send('pluginList', list)
|
event.sender.send('pluginList', list)
|
||||||
showNotification({
|
showNotification({
|
||||||
title: '导入插件成功',
|
title: T('PLUGIN_IMPORT_SUCCEED'),
|
||||||
body: ''
|
body: ''
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
showNotification({
|
showNotification({
|
||||||
title: '导入插件失败',
|
title: T('PLUGIN_IMPORT_FAILED'),
|
||||||
body: res.body as string
|
body: res.body as string
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import GuiApi from 'apis/gui'
|
|||||||
import { PICGO_CONFIG_PLUGIN, PICGO_HANDLE_PLUGIN_ING, PICGO_TOGGLE_PLUGIN } from '~/universal/events/constants'
|
import { PICGO_CONFIG_PLUGIN, PICGO_HANDLE_PLUGIN_ING, PICGO_TOGGLE_PLUGIN } from '~/universal/events/constants'
|
||||||
import picgoCoreIPC from '~/main/events/picgoCoreIPC'
|
import picgoCoreIPC from '~/main/events/picgoCoreIPC'
|
||||||
import { PicGo as PicGoCore } from 'picgo'
|
import { PicGo as PicGoCore } from 'picgo'
|
||||||
|
import { T } from '~/universal/i18n'
|
||||||
|
|
||||||
interface GuiMenuItem {
|
interface GuiMenuItem {
|
||||||
label: string
|
label: string
|
||||||
@ -39,7 +40,7 @@ const buildMiniPageMenu = () => {
|
|||||||
})
|
})
|
||||||
const template = [
|
const template = [
|
||||||
{
|
{
|
||||||
label: '打开详细窗口',
|
label: T('OPEN_MAIN_WINDOW'),
|
||||||
click () {
|
click () {
|
||||||
windowManager.get(IWindowList.SETTING_WINDOW)!.show()
|
windowManager.get(IWindowList.SETTING_WINDOW)!.show()
|
||||||
if (windowManager.has(IWindowList.MINI_WINDOW)) {
|
if (windowManager.has(IWindowList.MINI_WINDOW)) {
|
||||||
@ -48,30 +49,30 @@ const buildMiniPageMenu = () => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '选择默认图床',
|
label: T('CHOOSE_DEFAULT_PICBED'),
|
||||||
type: 'submenu',
|
type: 'submenu',
|
||||||
submenu
|
submenu
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '剪贴板图片上传',
|
label: T('UPLOAD_BY_CLIPBOARD'),
|
||||||
click () {
|
click () {
|
||||||
uploadClipboardFiles()
|
uploadClipboardFiles()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '隐藏窗口',
|
label: T('HIDE_WINDOW'),
|
||||||
click () {
|
click () {
|
||||||
BrowserWindow.getFocusedWindow()!.hide()
|
BrowserWindow.getFocusedWindow()!.hide()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '隐私协议',
|
label: T('PRIVACY_AGREEMENT'),
|
||||||
click () {
|
click () {
|
||||||
privacyManager.show(false)
|
privacyManager.show(false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '重启应用',
|
label: T('RELOAD_APP'),
|
||||||
click () {
|
click () {
|
||||||
app.relaunch()
|
app.relaunch()
|
||||||
app.exit(0)
|
app.exit(0)
|
||||||
@ -79,7 +80,7 @@ const buildMiniPageMenu = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
role: 'quit',
|
role: 'quit',
|
||||||
label: '退出'
|
label: T('QUIT')
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -89,7 +90,7 @@ const buildMiniPageMenu = () => {
|
|||||||
const buildMainPageMenu = () => {
|
const buildMainPageMenu = () => {
|
||||||
const template = [
|
const template = [
|
||||||
{
|
{
|
||||||
label: '关于',
|
label: T('ABOUT'),
|
||||||
click () {
|
click () {
|
||||||
dialog.showMessageBox({
|
dialog.showMessageBox({
|
||||||
title: 'PicGo',
|
title: 'PicGo',
|
||||||
@ -99,20 +100,20 @@ const buildMainPageMenu = () => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '赞助PicGo',
|
label: T('SPONSOR_PICGO'),
|
||||||
click () {
|
click () {
|
||||||
// TODO: show donation
|
// TODO: show donation
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '生成图床配置二维码',
|
label: T('SHOW_PICBED_QRCODE'),
|
||||||
click () {
|
click () {
|
||||||
// TODO: qrcode
|
// TODO: qrcode
|
||||||
// _this.qrcodeVisible = true
|
// _this.qrcodeVisible = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '隐私协议',
|
label: T('PRIVACY_AGREEMENT'),
|
||||||
click () {
|
click () {
|
||||||
privacyManager.show(false)
|
privacyManager.show(false)
|
||||||
}
|
}
|
||||||
@ -169,7 +170,7 @@ const handleRestoreState = (item: string, name: string): void => {
|
|||||||
|
|
||||||
const buildPluginPageMenu = (plugin: IPicGoPlugin) => {
|
const buildPluginPageMenu = (plugin: IPicGoPlugin) => {
|
||||||
const menu = [{
|
const menu = [{
|
||||||
label: '启用插件',
|
label: T('ENABLE_PLUGIN'),
|
||||||
enabled: !plugin.enabled,
|
enabled: !plugin.enabled,
|
||||||
click () {
|
click () {
|
||||||
picgo.saveConfig({
|
picgo.saveConfig({
|
||||||
@ -179,7 +180,7 @@ const buildPluginPageMenu = (plugin: IPicGoPlugin) => {
|
|||||||
window.webContents.send(PICGO_TOGGLE_PLUGIN, plugin.fullName, true)
|
window.webContents.send(PICGO_TOGGLE_PLUGIN, plugin.fullName, true)
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
label: '禁用插件',
|
label: T('DISABLE_PLUGIN'),
|
||||||
enabled: plugin.enabled,
|
enabled: plugin.enabled,
|
||||||
click () {
|
click () {
|
||||||
picgo.saveConfig({
|
picgo.saveConfig({
|
||||||
@ -196,14 +197,14 @@ const buildPluginPageMenu = (plugin: IPicGoPlugin) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
label: '卸载插件',
|
label: T('UNINSTALL_PLUGIN'),
|
||||||
click () {
|
click () {
|
||||||
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
||||||
window.webContents.send(PICGO_HANDLE_PLUGIN_ING, plugin.fullName)
|
window.webContents.send(PICGO_HANDLE_PLUGIN_ING, plugin.fullName)
|
||||||
picgoCoreIPC.handlePluginUninstall(plugin.fullName)
|
picgoCoreIPC.handlePluginUninstall(plugin.fullName)
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
label: '更新插件',
|
label: T('UPDATE_PLUGIN'),
|
||||||
click () {
|
click () {
|
||||||
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
||||||
window.webContents.send(PICGO_HANDLE_PLUGIN_ING, plugin.fullName)
|
window.webContents.send(PICGO_HANDLE_PLUGIN_ING, plugin.fullName)
|
||||||
@ -213,7 +214,9 @@ const buildPluginPageMenu = (plugin: IPicGoPlugin) => {
|
|||||||
for (const i in plugin.config) {
|
for (const i in plugin.config) {
|
||||||
if (plugin.config[i].config.length > 0) {
|
if (plugin.config[i].config.length > 0) {
|
||||||
const obj = {
|
const obj = {
|
||||||
label: `配置${i} - ${plugin.config[i].fullName || plugin.config[i].name}`,
|
label: T('CONFIG_THING', {
|
||||||
|
c: `${i} - ${plugin.config[i].fullName || plugin.config[i].name}`
|
||||||
|
}),
|
||||||
click () {
|
click () {
|
||||||
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
||||||
const currentType = i
|
const currentType = i
|
||||||
@ -231,7 +234,7 @@ const buildPluginPageMenu = (plugin: IPicGoPlugin) => {
|
|||||||
const currentTransformer = picgo.getConfig<string>('picBed.transformer') || 'path'
|
const currentTransformer = picgo.getConfig<string>('picBed.transformer') || 'path'
|
||||||
const pluginTransformer = plugin.config.transformer.name
|
const pluginTransformer = plugin.config.transformer.name
|
||||||
const obj = {
|
const obj = {
|
||||||
label: `${currentTransformer === pluginTransformer ? '禁用' : '启用'}transformer - ${plugin.config.transformer.name}`,
|
label: `${currentTransformer === pluginTransformer ? T('DISABLE') : T('ENABLE')}transformer - ${plugin.config.transformer.name}`,
|
||||||
click () {
|
click () {
|
||||||
const transformer = plugin.config.transformer.name
|
const transformer = plugin.config.transformer.name
|
||||||
const currentTransformer = picgo.getConfig<string>('picBed.transformer') || 'path'
|
const currentTransformer = picgo.getConfig<string>('picBed.transformer') || 'path'
|
||||||
|
@ -3,6 +3,7 @@ import ConfigStore from '~/main/apis/core/datastore'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import fse from 'fs-extra'
|
import fse from 'fs-extra'
|
||||||
import { PicGo as PicGoCore } from 'picgo'
|
import { PicGo as PicGoCore } from 'picgo'
|
||||||
|
import { T } from '~/universal/i18n'
|
||||||
// from v2.1.2
|
// from v2.1.2
|
||||||
const updateShortKeyFromVersion212 = (db: typeof ConfigStore, shortKeyConfig: IShortKeyConfigs | IOldShortKeyConfigs) => {
|
const updateShortKeyFromVersion212 = (db: typeof ConfigStore, shortKeyConfig: IShortKeyConfigs | IOldShortKeyConfigs) => {
|
||||||
// #557 极端情况可能会出现配置不存在,需要重新写入
|
// #557 极端情况可能会出现配置不存在,需要重新写入
|
||||||
@ -11,7 +12,7 @@ const updateShortKeyFromVersion212 = (db: typeof ConfigStore, shortKeyConfig: IS
|
|||||||
enable: true,
|
enable: true,
|
||||||
key: 'CommandOrControl+Shift+P',
|
key: 'CommandOrControl+Shift+P',
|
||||||
name: 'upload',
|
name: 'upload',
|
||||||
label: '快捷上传'
|
label: T('QUICK_UPLOAD')
|
||||||
}
|
}
|
||||||
db.set('settings.shortKey[picgo:upload]', defaultShortKeyConfig)
|
db.set('settings.shortKey[picgo:upload]', defaultShortKeyConfig)
|
||||||
return true
|
return true
|
||||||
@ -22,7 +23,7 @@ const updateShortKeyFromVersion212 = (db: typeof ConfigStore, shortKeyConfig: IS
|
|||||||
enable: true,
|
enable: true,
|
||||||
key: shortKeyConfig.upload,
|
key: shortKeyConfig.upload,
|
||||||
name: 'upload',
|
name: 'upload',
|
||||||
label: '快捷上传'
|
label: T('QUICK_UPLOAD')
|
||||||
}
|
}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
delete shortKeyConfig.upload
|
delete shortKeyConfig.upload
|
||||||
|
@ -2,6 +2,7 @@ import db from '~/main/apis/core/datastore'
|
|||||||
import { ipcMain } from 'electron'
|
import { ipcMain } from 'electron'
|
||||||
import { showMessageBox } from '~/main/utils/common'
|
import { showMessageBox } from '~/main/utils/common'
|
||||||
import { SHOW_PRIVACY_MESSAGE } from '~/universal/events/constants'
|
import { SHOW_PRIVACY_MESSAGE } from '~/universal/events/constants'
|
||||||
|
import { T } from '~/universal/i18n'
|
||||||
|
|
||||||
class PrivacyManager {
|
class PrivacyManager {
|
||||||
async init () {
|
async init () {
|
||||||
@ -25,7 +26,7 @@ class PrivacyManager {
|
|||||||
const res = await showMessageBox({
|
const res = await showMessageBox({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
buttons: showCancel ? ['Yes', 'No'] : ['Yes'],
|
buttons: showCancel ? ['Yes', 'No'] : ['Yes'],
|
||||||
title: '隐私协议',
|
title: T('PRIVACY_AGREEMENT'),
|
||||||
message: `
|
message: `
|
||||||
本软件尊重并保护所有使用服务用户的个人隐私权。为了给您提供更准确、更优质的服务,本软件会按照本隐私权政策的规定使用和收集您的一些行为信息。您在同意本软件服务使用协议之时,即视为您已经同意本隐私权政策全部内容。本隐私权政策属于本软件服务使用协议不可分割的一部分,如果不同意将无法使用。本协议会定期更新。
|
本软件尊重并保护所有使用服务用户的个人隐私权。为了给您提供更准确、更优质的服务,本软件会按照本隐私权政策的规定使用和收集您的一些行为信息。您在同意本软件服务使用协议之时,即视为您已经同意本隐私权政策全部内容。本隐私权政策属于本软件服务使用协议不可分割的一部分,如果不同意将无法使用。本协议会定期更新。
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ import db from '~/main/apis/core/datastore'
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import pkg from 'root/package.json'
|
import pkg from 'root/package.json'
|
||||||
import { lt } from 'semver'
|
import { lt } from 'semver'
|
||||||
|
import { T } from '~/universal/i18n'
|
||||||
const version = pkg.version
|
const version = pkg.version
|
||||||
const releaseUrl = 'https://api.github.com/repos/Molunerfinn/PicGo/releases/latest'
|
const releaseUrl = 'https://api.github.com/repos/Molunerfinn/PicGo/releases/latest'
|
||||||
const releaseUrlBackup = 'https://cdn.jsdelivr.net/gh/Molunerfinn/PicGo@latest/package.json'
|
const releaseUrlBackup = 'https://cdn.jsdelivr.net/gh/Molunerfinn/PicGo@latest/package.json'
|
||||||
@ -30,10 +31,12 @@ const checkVersion = async () => {
|
|||||||
if (result) {
|
if (result) {
|
||||||
dialog.showMessageBox({
|
dialog.showMessageBox({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
title: '发现新版本',
|
title: T('FIND_NEW_VERSION'),
|
||||||
buttons: ['Yes', 'No'],
|
buttons: ['Yes', 'No'],
|
||||||
message: `发现新版本${latest},更新了很多功能,是否去下载最新的版本?`,
|
message: T('TIPS_FIND_NEW_VERSION', {
|
||||||
checkboxLabel: '以后不再提醒',
|
v: latest
|
||||||
|
}),
|
||||||
|
checkboxLabel: T('NO_MORE_NOTICE'),
|
||||||
checkboxChecked: false
|
checkboxChecked: false
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.response === 0) { // if selected yes
|
if (res.response === 0) { // if selected yes
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable no-template-curly-in-string */
|
||||||
export const ZH_CN = {
|
export const ZH_CN = {
|
||||||
ABOUT: '关于',
|
ABOUT: '关于',
|
||||||
OPEN_MAIN_WINDOW: '打开主窗口',
|
OPEN_MAIN_WINDOW: '打开主窗口',
|
||||||
@ -5,7 +6,50 @@ export const ZH_CN = {
|
|||||||
OPEN_UPDATE_HELPER: '打开更新助手',
|
OPEN_UPDATE_HELPER: '打开更新助手',
|
||||||
PRIVACY_AGREEMENT: '隐私协议',
|
PRIVACY_AGREEMENT: '隐私协议',
|
||||||
RELOAD_APP: '重启应用',
|
RELOAD_APP: '重启应用',
|
||||||
UPLOAD_SUCCESSFULLY: '上传成功',
|
UPLOAD_SUCCEED: '上传成功',
|
||||||
|
UPLOAD_FAILED: '上传失败',
|
||||||
|
UPLOAD_PROGRESS: '上传进度',
|
||||||
|
OPERATION_SUCCEED: '操作成功',
|
||||||
|
OPERATION_FAILED: '操作失败',
|
||||||
|
UPLOADING: '正在上传',
|
||||||
|
QUICK_UPLOAD: '快捷上传',
|
||||||
|
UPLOAD_BY_CLIPBOARD: '剪贴板图片上传',
|
||||||
|
HIDE_WINDOW: '隐藏窗口',
|
||||||
|
SPONSOR_PICGO: '赞助 PicGo',
|
||||||
|
SHOW_PICBED_QRCODE: '生成图床配置二维码',
|
||||||
|
ENABLE: '启用',
|
||||||
|
DISABLE: '禁用',
|
||||||
|
CONFIG_THING: '配置${c}',
|
||||||
|
FIND_NEW_VERSION: '发现新版本',
|
||||||
|
NO_MORE_NOTICE: '以后不再提醒',
|
||||||
|
// plugins
|
||||||
|
PLUGIN_INSTALL_SUCCEED: '插件安装成功',
|
||||||
|
PLUGIN_INSTALL_FAILED: '插件安装失败',
|
||||||
|
PLUGIN_UNINSTALL_SUCCEED: '插件卸载成功',
|
||||||
|
PLUGIN_UNINSTALL_FAILED: '插件卸载失败',
|
||||||
|
PLUGIN_UPDATE_SUCCEED: '插件更新成功',
|
||||||
|
PLUGIN_UPDATE_FAILED: '插件更新失败',
|
||||||
|
PLUGIN_IMPORT_SUCCEED: '插件导入成功',
|
||||||
|
PLUGIN_IMPORT_FAILED: '插件导入失败',
|
||||||
|
ENABLE_PLUGIN: '启用插件',
|
||||||
|
DISABLE_PLUGIN: '禁用插件',
|
||||||
|
UNINSTALL_PLUGIN: '卸载插件',
|
||||||
|
UPDATE_PLUGIN: '更新插件',
|
||||||
|
// tips
|
||||||
|
TIPS_NOTICE: '注意',
|
||||||
|
TIPS_WARNING: '警告',
|
||||||
|
TIPS_ERROR: '发生错误',
|
||||||
|
TIPS_INSTALL_NODE_AND_RELOAD_PICGO: '请安装Node.js并重启PicGo再继续操作',
|
||||||
|
TIPS_PLUGIN_REMOVE_GALLERY_ITEM: '有插件正在试图删除一些相册图片,是否继续',
|
||||||
|
TIPS_UPLOAD_NOT_PICTURES: '剪贴板最新的一条记录不是图片',
|
||||||
|
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_DEFAULT: 'PicGo 配置文件损坏,已经恢复为默认配置',
|
||||||
|
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_BACKUP: 'PicGo 配置文件损坏,已经恢复为备份配置',
|
||||||
|
TIPS_PICGO_BACKUP_FILE_VERSION: '备份文件版本: ${v}',
|
||||||
|
TIPS_CUSTOM_CONFIG_FILE_PATH_ERROR: '自定义文件解析出错,请检查路径内容是否正确',
|
||||||
|
TIPS_SHORTCUT_MODIFIED_SUCCEED: '快捷键已经修改成功',
|
||||||
|
TIPS_SHORTCUT_MODIFIED_CONFLICT: '快捷键冲突,请重新设置',
|
||||||
|
TIPS_CUSTOM_LINK_STYLE_MODIFIED_SUCCEED: '自定义链接格式已经修改成功',
|
||||||
|
TIPS_FIND_NEW_VERSION: '发现新版本${v},更新了很多功能,是否去下载最新的版本?',
|
||||||
QUIT: '退出'
|
QUIT: '退出'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user