From e9c386d5d832a598f143545619cf67c255d8b1c8 Mon Sep 17 00:00:00 2001 From: Kuingsmile Date: Thu, 13 Jun 2024 11:13:58 +0800 Subject: [PATCH] :sparkles: Feature(custom): update i18n force update --- package.json | 2 +- public/i18n/zh-TW.yml | 4 ++-- src/main.ts | 16 +++++++++------- src/main/events/rpc/routes/system/app.ts | 6 +++--- src/renderer/App.vue | 23 +++++++---------------- src/renderer/i18n/index.ts | 20 +++++++------------- src/renderer/store/index.ts | 13 ++----------- src/renderer/utils/bus.ts | 6 ++---- src/renderer/utils/common.ts | 5 +++++ src/renderer/utils/global.ts | 9 ++++++++- src/renderer/utils/mainMixin.ts | 24 ------------------------ src/universal/events/constants.ts | 8 ++++---- src/universal/types/extra-vue.d.ts | 1 - yarn.lock | 8 ++++---- 14 files changed, 54 insertions(+), 91 deletions(-) delete mode 100644 src/renderer/utils/mainMixin.ts diff --git a/package.json b/package.json index da0cd34e..3a4ea0fc 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "@aws-sdk/lib-storage": "^3.421.0", "@aws-sdk/s3-request-presigner": "^3.421.0", "@element-plus/icons-vue": "^2.3.1", - "@highlightjs/vue-plugin": "^2.1.0", + "@highlightjs/vue-plugin": "^2.1.2", "@nodelib/fs.walk": "^2.0.0", "@octokit/rest": "^19.0.7", "@picgo/i18n": "^1.0.0", diff --git a/public/i18n/zh-TW.yml b/public/i18n/zh-TW.yml index 83793d0a..2e0be82c 100644 --- a/public/i18n/zh-TW.yml +++ b/public/i18n/zh-TW.yml @@ -49,13 +49,13 @@ TOOLBOX_CHECK_PROXY_SUCCESS_TIPS: 代理設置正常 TOOLBOX_CHECK_PROXY_NO_PROXY_TIPS: 無代理設置 TOOLBOX_CHECK_PROXY_PROXY_IS_NOT_CORRECT: 代理設置不正確 TOOLBOX_CHECK_PROXY_PROXY_IS_NOT_WORKING: 代理設置不可用 -TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_TIPS: 剪貼板圖片臨時文件夾路徑是:${path} +TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_TIPS: 剪貼板圖片臨時文件夾路徑是:${path} TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_NOT_EXIST_TIPS: 剪貼板圖片臨時文件夾不存在:${path} TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_ERROR_TIPS: 請自行創建文件夾:${path} MANUAL_PAGE_OPEN_TIP: 請選擇打開方式 MANUAL_PAGE_OPEN_TIP_TITLE: Tips MANUAL_PAGE_OPEN_BY_BROWSER: 瀏覽器 -MANUAL_PAGE_OPEN_BY_BUILD_IN: 內置窗口s +MANUAL_PAGE_OPEN_BY_BUILD_IN: 內置窗口 MANUAL_PAGE_OPEN_SETTING_TIP: 選擇打開手冊方式 # ---renderer i18n begin--- diff --git a/src/main.ts b/src/main.ts index 4fc3204f..911de3d8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,27 +1,31 @@ import { webFrame } from 'electron' import ElementUI from 'element-plus' import 'element-plus/dist/index.css' + import { createPinia } from 'pinia' import piniaPluginPersistedstate from 'pinia-plugin-persistedstate' + import { createApp } from 'vue' import VueLazyLoad from 'vue3-lazyload' + import vue3PhotoPreview from 'vue3-photo-preview' import 'vue3-photo-preview/dist/index.css' + import VueVideoPlayer from '@videojs-player/vue' -import 'highlight.js/styles/atom-one-dark.css' -import hljsVuePlugin from '@highlightjs/vue-plugin' -import hljsCommon from 'highlight.js/lib/common' import 'video.js/dist/video-js.css' +import 'highlight.js/styles/stackoverflow-light.css' +import hljsVuePlugin from '@highlightjs/vue-plugin' +import 'highlight.js/lib/common' + import App from '@/App.vue' import router from '@/router' +import { sendRPC, sendToMain, triggerRPC } from '@/utils/common' import db from '@/utils/db' import { T } from '@/i18n/index' import { store } from '@/store' import { initTalkingData } from '@/utils/analytic' -import { mainMixin } from '@/utils/mainMixin' import { dragMixin } from '@/utils/mixin' -import { sendRPC, sendToMain, triggerRPC } from '@/utils/common' webFrame.setVisualZoomLevelLimits(1, 1) @@ -33,7 +37,6 @@ app.config.globalProperties.triggerRPC = triggerRPC app.config.globalProperties.sendRPC = sendRPC app.config.globalProperties.sendToMain = sendToMain -app.mixin(mainMixin) app.mixin(dragMixin) const pinia = createPinia() pinia.use(piniaPluginPersistedstate) @@ -45,7 +48,6 @@ app.use(router) app.use(store) app.use(vue3PhotoPreview) app.use(pinia) -console.log(hljsCommon.highlightAuto('

Highlight.js has been registered successfully!

').value) app.use(hljsVuePlugin) app.use(VueVideoPlayer) app.mount('#app') diff --git a/src/main/events/rpc/routes/system/app.ts b/src/main/events/rpc/routes/system/app.ts index 6a9b76fd..d1b24503 100644 --- a/src/main/events/rpc/routes/system/app.ts +++ b/src/main/events/rpc/routes/system/app.ts @@ -6,7 +6,7 @@ import windowManager from 'apis/app/window/windowManager' import { i18nManager } from '~/i18n' import { IRPCActionType, IWindowList } from '#/types/enum' -import { GET_CURRENT_LANGUAGE, GET_LANGUAGE_LIST, SET_CURRENT_LANGUAGE } from '#/events/constants' +import { SET_CURRENT_LANGUAGE } from '#/events/constants' export default [ { @@ -31,14 +31,14 @@ export default [ { action: IRPCActionType.GET_LANGUAGE_LIST, handler: async (event: IIPCEvent) => { - event.sender.send(GET_LANGUAGE_LIST, i18nManager.languageList) + event.returnValue = i18nManager.languageList } }, { action: IRPCActionType.GET_CURRENT_LANGUAGE, handler: async (event: IIPCEvent) => { const { lang, locales } = i18nManager.getCurrentLocales() - event.sender.send(GET_CURRENT_LANGUAGE, lang, locales) + event.returnValue = [lang, locales] } }, { diff --git a/src/renderer/App.vue b/src/renderer/App.vue index 5cb84e4f..7cb4db9d 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -1,19 +1,20 @@