mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-06 20:42:57 +08:00
✨ Feature(custom): set language to system language at first start up
This commit is contained in:
@@ -25,6 +25,8 @@
|
|||||||
- Linux 新增 `rpm` 安装包
|
- Linux 新增 `rpm` 安装包
|
||||||
- 新增图床编辑卡片页面,解决多配置切换时的混乱问题
|
- 新增图床编辑卡片页面,解决多配置切换时的混乱问题
|
||||||
- 文件浏览页面新增列表模式支持。
|
- 文件浏览页面新增列表模式支持。
|
||||||
|
- 现在第一次启动时根据系统语言自动选择界面语言
|
||||||
|
- 现在windows系统第一次启动时会默认显示主界面
|
||||||
- 现在支持手动关闭 GPU 加速,解决部分硬件兼容性导致的黑屏或闪烁问题
|
- 现在支持手动关闭 GPU 加速,解决部分硬件兼容性导致的黑屏或闪烁问题
|
||||||
- 新增高级动画设置,开启后可获得更佳的 UI 交互体验
|
- 新增高级动画设置,开启后可获得更佳的 UI 交互体验
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ Use custom `javascript` scripts to extend PicList's functionality without the ne
|
|||||||
- Added `rpm` installation package for Linux.
|
- Added `rpm` installation package for Linux.
|
||||||
- Added image hosting editing card page to resolve confusion when switching multiple configurations.
|
- Added image hosting editing card page to resolve confusion when switching multiple configurations.
|
||||||
- Added list mode support to the file browsing page.
|
- Added list mode support to the file browsing page.
|
||||||
|
- Now automatically selects the interface language based on the system language on the first launch.
|
||||||
|
- Now the main interface will be displayed by default on the first launch of Windows systems.
|
||||||
- Now supports manually disabling GPU acceleration to resolve black screen or flickering issues caused by some hardware compatibility.
|
- Now supports manually disabling GPU acceleration to resolve black screen or flickering issues caused by some hardware compatibility.
|
||||||
- Added advanced animation settings for a better UI interaction experience when enabled.
|
- Added advanced animation settings for a better UI interaction experience when enabled.
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
"multer": "^2.0.2",
|
"multer": "^2.0.2",
|
||||||
"node-ssh-no-cpu-features": "^2.0.0",
|
"node-ssh-no-cpu-features": "^2.0.0",
|
||||||
"nodejs-file-downloader": "^4.13.0",
|
"nodejs-file-downloader": "^4.13.0",
|
||||||
"piclist": "^2.3.0",
|
"piclist": "^2.3.2",
|
||||||
"qiniu": "7.14.0",
|
"qiniu": "7.14.0",
|
||||||
"semver": "^7.7.3",
|
"semver": "^7.7.3",
|
||||||
"shell-path": "3.0.0",
|
"shell-path": "3.0.0",
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import yaml from 'yaml'
|
|||||||
|
|
||||||
import { configPaths } from '~/utils/configPaths'
|
import { configPaths } from '~/utils/configPaths'
|
||||||
import { II18nLanguage, IWindowList } from '~/utils/enum'
|
import { II18nLanguage, IWindowList } from '~/utils/enum'
|
||||||
|
|
||||||
const dirname = path.dirname(fileURLToPath(import.meta.url))
|
const dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||||
|
|
||||||
let newVersion = ''
|
let newVersion = ''
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import path from 'node:path'
|
|||||||
import { pathToFileURL } from 'node:url'
|
import { pathToFileURL } from 'node:url'
|
||||||
|
|
||||||
import bus from '@core/bus'
|
import bus from '@core/bus'
|
||||||
|
import { themesDir } from '@core/datastore/dirs'
|
||||||
import picgo from '@core/picgo'
|
import picgo from '@core/picgo'
|
||||||
import logger from '@core/picgo/logger'
|
import logger from '@core/picgo/logger'
|
||||||
import { remoteNoticeHandler } from 'apis/app/remoteNotice'
|
import { remoteNoticeHandler } from 'apis/app/remoteNotice'
|
||||||
@@ -15,10 +16,10 @@ import { app, globalShortcut, net, Notification, protocol, screen } from 'electr
|
|||||||
import { installExtension, VUEJS_DEVTOOLS_BETA } from 'electron-devtools-installer'
|
import { installExtension, VUEJS_DEVTOOLS_BETA } from 'electron-devtools-installer'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
|
|
||||||
import { themesDir } from '~/apis/core/datastore/dirs'
|
|
||||||
import busEventList from '~/events/busEventList'
|
import busEventList from '~/events/busEventList'
|
||||||
import { rpcServer } from '~/events/rpc'
|
import { rpcServer } from '~/events/rpc'
|
||||||
import { startFileServer, stopFileServer } from '~/fileServer'
|
import { startFileServer, stopFileServer } from '~/fileServer'
|
||||||
|
import { i18nManager } from '~/i18n'
|
||||||
import { setupAutoUpdater } from '~/lifeCycle/autoUpdater'
|
import { setupAutoUpdater } from '~/lifeCycle/autoUpdater'
|
||||||
import fixPath from '~/lifeCycle/fixPath'
|
import fixPath from '~/lifeCycle/fixPath'
|
||||||
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
||||||
@@ -30,13 +31,14 @@ import { isAutoStartEnabled, setAutoStart } from '~/utils/autoStart'
|
|||||||
import beforeOpen from '~/utils/beforeOpen'
|
import beforeOpen from '~/utils/beforeOpen'
|
||||||
import clipboardPoll from '~/utils/clipboardPoll'
|
import clipboardPoll from '~/utils/clipboardPoll'
|
||||||
import { configPaths } from '~/utils/configPaths'
|
import { configPaths } from '~/utils/configPaths'
|
||||||
import { IRemoteNoticeTriggerHook, ISartMode, IWindowList } from '~/utils/enum'
|
import { II18nLanguage, IRemoteNoticeTriggerHook, ISartMode, IWindowList } from '~/utils/enum'
|
||||||
import { getUploadFiles } from '~/utils/handleArgv'
|
import { getUploadFiles } from '~/utils/handleArgv'
|
||||||
import { initI18n } from '~/utils/handleI18n'
|
import { initI18n } from '~/utils/handleI18n'
|
||||||
import { notificationList } from '~/utils/notification'
|
import { notificationList } from '~/utils/notification'
|
||||||
import { runScriptInStage } from '~/utils/runScript'
|
import { runScriptInStage } from '~/utils/runScript'
|
||||||
import { CLIPBOARD_IMAGE_FOLDER } from '~/utils/static'
|
import { CLIPBOARD_IMAGE_FOLDER } from '~/utils/static'
|
||||||
import updateChecker from '~/utils/updateChecker'
|
import updateChecker from '~/utils/updateChecker'
|
||||||
|
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||||
process.noDeprecation = true
|
process.noDeprecation = true
|
||||||
|
|
||||||
@@ -112,8 +114,24 @@ class LifeCycle {
|
|||||||
} else {
|
} else {
|
||||||
picgo.saveConfig({ [configPaths.settings.isListeningClipboard]: false })
|
picgo.saveConfig({ [configPaths.settings.isListeningClipboard]: false })
|
||||||
}
|
}
|
||||||
|
const locale = app.getLocale() || 'zh-CN'
|
||||||
|
if (allConfig.settings?.language === undefined) {
|
||||||
|
if (locale.startsWith('zh')) {
|
||||||
|
i18nManager.setCurrentLanguage(II18nLanguage.ZH_CN)
|
||||||
|
picgo.saveConfig({ [configPaths.settings.language]: 'zh-CN' })
|
||||||
|
} else {
|
||||||
|
i18nManager.setCurrentLanguage(II18nLanguage.EN)
|
||||||
|
picgo.saveConfig({ [configPaths.settings.language]: 'en' })
|
||||||
|
}
|
||||||
|
}
|
||||||
const isHideDock = allConfig.settings?.isHideDock || false
|
const isHideDock = allConfig.settings?.isHideDock || false
|
||||||
let startMode = allConfig.settings?.startMode || ISartMode.MAIN
|
|
||||||
|
let startMode =
|
||||||
|
allConfig.settings?.startMode !== undefined
|
||||||
|
? allConfig.settings.startMode
|
||||||
|
: process.platform === 'win32'
|
||||||
|
? ISartMode.MAIN
|
||||||
|
: ISartMode.QUIET
|
||||||
if (process.platform === 'darwin' && startMode === ISartMode.MINI) {
|
if (process.platform === 'darwin' && startMode === ISartMode.MINI) {
|
||||||
startMode = ISartMode.QUIET
|
startMode = ISartMode.QUIET
|
||||||
}
|
}
|
||||||
@@ -128,7 +146,6 @@ class LifeCycle {
|
|||||||
}
|
}
|
||||||
picgo.saveConfig({ [configPaths.needReload]: false })
|
picgo.saveConfig({ [configPaths.needReload]: false })
|
||||||
updateChecker()
|
updateChecker()
|
||||||
// 不需要阻塞
|
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
shortKeyHandler.init()
|
shortKeyHandler.init()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -909,6 +909,7 @@
|
|||||||
"editTheme": "Edit Theme",
|
"editTheme": "Edit Theme",
|
||||||
"enableAdvancedAnimation": "Enable Advanced Animation",
|
"enableAdvancedAnimation": "Enable Advanced Animation",
|
||||||
"enableAdvancedAnimationDesc": "Do not enable this option on low-performance devices or when GPU acceleration is disabled",
|
"enableAdvancedAnimationDesc": "Do not enable this option on low-performance devices or when GPU acceleration is disabled",
|
||||||
|
"getThemeContentFailed": "Failed to get theme content",
|
||||||
"hideDockHint": "Cannot hide both dock and tray at the same time",
|
"hideDockHint": "Cannot hide both dock and tray at the same time",
|
||||||
"importThemes": "Import Themes",
|
"importThemes": "Import Themes",
|
||||||
"importThemesFailed": "Failed to import themes",
|
"importThemesFailed": "Failed to import themes",
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import db from '@/utils/db'
|
|||||||
type MessageSchema = typeof zhCN
|
type MessageSchema = typeof zhCN
|
||||||
|
|
||||||
window.electron.setVisualZoomLevelLimits(1, 1)
|
window.electron.setVisualZoomLevelLimits(1, 1)
|
||||||
|
const userLanguage = navigator.language || 'zh-CN'
|
||||||
|
const defaultLanguage = userLanguage.startsWith('zh') ? 'zh-CN' : 'en'
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|
||||||
@@ -32,7 +34,7 @@ app.config.globalProperties.sendToMain = window.electron.sendToMain
|
|||||||
|
|
||||||
const i18n = createI18n<[MessageSchema], 'en' | 'zh-CN' | 'zh-TW'>({
|
const i18n = createI18n<[MessageSchema], 'en' | 'zh-CN' | 'zh-TW'>({
|
||||||
legacy: false,
|
legacy: false,
|
||||||
locale: localStorage.getItem('currentLanguage') || 'zh-CN',
|
locale: localStorage.getItem('currentLanguage') || defaultLanguage,
|
||||||
fallbackLocale: 'zh-CN',
|
fallbackLocale: 'zh-CN',
|
||||||
messages: {
|
messages: {
|
||||||
en,
|
en,
|
||||||
|
|||||||
@@ -1834,7 +1834,12 @@ async function initData() {
|
|||||||
formOfSetting.value.logLevel = initArray(settings.logLevel || [], ['all'])
|
formOfSetting.value.logLevel = initArray(settings.logLevel || [], ['all'])
|
||||||
formOfSetting.value.autoImportPicBed = initArray(settings.autoImportPicBed || [], [])
|
formOfSetting.value.autoImportPicBed = initArray(settings.autoImportPicBed || [], [])
|
||||||
currentLanguage.value = settings.language || 'zh-CN'
|
currentLanguage.value = settings.language || 'zh-CN'
|
||||||
currentStartMode.value = settings.startMode || ISartMode.QUIET
|
currentStartMode.value =
|
||||||
|
settings.startMode !== undefined
|
||||||
|
? settings.startMode
|
||||||
|
: osGlobal.value === 'win32'
|
||||||
|
? ISartMode.MAIN
|
||||||
|
: ISartMode.QUIET
|
||||||
currentSecondMode.value = settings.secondPicBedMode || 'backup'
|
currentSecondMode.value = settings.secondPicBedMode || 'backup'
|
||||||
if (osGlobal.value === 'darwin' && currentStartMode.value === ISartMode.MINI) {
|
if (osGlobal.value === 'darwin' && currentStartMode.value === ISartMode.MINI) {
|
||||||
currentStartMode.value = ISartMode.QUIET
|
currentStartMode.value = ISartMode.QUIET
|
||||||
|
|||||||
@@ -9728,10 +9728,10 @@ performance-now@^2.1.0:
|
|||||||
resolved "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
|
resolved "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
|
||||||
integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==
|
integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==
|
||||||
|
|
||||||
piclist@^2.3.0:
|
piclist@^2.3.2:
|
||||||
version "2.3.0"
|
version "2.3.2"
|
||||||
resolved "https://registry.yarnpkg.com/piclist/-/piclist-2.3.0.tgz#3376b5d67e8068d11b015be577c6bb2389e307f2"
|
resolved "https://registry.yarnpkg.com/piclist/-/piclist-2.3.2.tgz#77cfecc5931b6761d26acc969d6ecda9b7605d6f"
|
||||||
integrity sha512-LwLBi6Afi00tD5Wg5S9luxW3BZAVeL9goUI/vMNItPzKZKdh/qYpjUKkNkhYV19kU71RXZeJ+N26//vs+2xtVg==
|
integrity sha512-s03G5r4HJffRgNEI72FefI9GDf8JSvw27LhslDwtmjpu/jvUVHru/VCwGaFBHyItW58nrqDh+W7gCfZ8x6ENhw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@aws-sdk/client-s3" "3.965.0"
|
"@aws-sdk/client-s3" "3.965.0"
|
||||||
"@aws-sdk/lib-storage" "3.965.0"
|
"@aws-sdk/lib-storage" "3.965.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user