release: bump version to 0.82.0
This commit is contained in:
1 parent
b3d2d9e9f1
commit
04cebdc504
131 files changed
+17975
-2323
No files matched your search
@@ -18,6 +18,7 @@ import {
|
||||
type StartupGpuDecision,
|
||||
type StartupGpuDecisionReason,
|
||||
} from './gpu-policy'
|
||||
import { tClient } from './i18n'
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
|
||||
@@ -296,14 +297,20 @@ export function createAdaptiveGpuMonitor(options: {
|
||||
}
|
||||
if (record.reason === 'low-fps-low-vram') {
|
||||
return record.target === 'software'
|
||||
? { message: '独显显存不足且帧率偏低,已自动切换至 CPU 软渲染', type: 'info' }
|
||||
? {
|
||||
message: tClient('独显显存不足且帧率偏低,已自动切换至软件兼容渲染', 'Low VRAM and FPS; switched to software rendering'),
|
||||
type: 'info',
|
||||
}
|
||||
: {
|
||||
message: '独显显存不足且帧率偏低,已自动切换至集成核显渲染(保留全部特效)',
|
||||
message: tClient('独显显存不足且帧率偏低,已自动切换至节能核显', 'Low VRAM and FPS; switched to integrated GPU'),
|
||||
type: 'info',
|
||||
}
|
||||
}
|
||||
if (record.reason === 'vram-recovered') {
|
||||
return { message: '独显显存已充足,已自动切回独立显卡渲染', type: 'success' }
|
||||
return {
|
||||
message: tClient('独显显存已充足,已自动切回高性能显卡', 'VRAM recovered; switched back to high-performance GPU'),
|
||||
type: 'success',
|
||||
}
|
||||
}
|
||||
return null
|
||||
},
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
shouldSuppressUpdatePrompt,
|
||||
type ClientUpdateManifest,
|
||||
} from './hot-update-core'
|
||||
import { tClient } from './i18n'
|
||||
|
||||
export interface HotUpdateVersionInfo {
|
||||
shellVersion: string
|
||||
@@ -129,7 +130,10 @@ export function createHotUpdateController(options: {
|
||||
pendingVerification = false
|
||||
markHotfixVerified(options.userDataDir)
|
||||
options.onOverlayChanged(overlayRoot, activeBundleVersion)
|
||||
notifyStatus(`热更新已生效 / Hotfix v${activeBundleVersion} active`, 'success')
|
||||
notifyStatus(
|
||||
tClient(`更新已生效 (v${activeBundleVersion})`, `Update v${activeBundleVersion} active`),
|
||||
'success',
|
||||
)
|
||||
}
|
||||
|
||||
const handleRendererCrash = () => {
|
||||
@@ -146,7 +150,10 @@ export function createHotUpdateController(options: {
|
||||
}
|
||||
|
||||
const applyHotfixBundle = async (bundleUrl: string, version: string, expectedSha256: string) => {
|
||||
notifyStatus(`正在下载热更新 v${version}… / Downloading hotfix v${version}…`, 'info')
|
||||
notifyStatus(
|
||||
tClient(`正在下载更新 v${version}…`, `Downloading update v${version}…`),
|
||||
'info',
|
||||
)
|
||||
const response = await fetchWithTimeout(fetchImpl, bundleUrl, DOWNLOAD_TIMEOUT_MS, {
|
||||
cache: 'no-store',
|
||||
})
|
||||
@@ -198,10 +205,10 @@ export function createHotUpdateController(options: {
|
||||
if (manual) {
|
||||
await showBox({
|
||||
type: 'warning',
|
||||
title: '检查更新失败 / Update Check Failed',
|
||||
message: '无法获取版本清单,请确认服务端连接正常。',
|
||||
title: tClient('检查更新失败', 'Update Check Failed'),
|
||||
message: tClient('无法获取版本清单,请确认网络连接正常。', 'Unable to fetch update manifest. Please check your connection.'),
|
||||
detail,
|
||||
buttons: ['确定 / OK'],
|
||||
buttons: [tClient('确定', 'OK')],
|
||||
})
|
||||
} else {
|
||||
console.warn('[planet-client] Startup update check skipped:', detail)
|
||||
@@ -221,10 +228,13 @@ export function createHotUpdateController(options: {
|
||||
if (manual) {
|
||||
await showBox({
|
||||
type: 'info',
|
||||
title: '当前已是最新版本 / Up to Date',
|
||||
message: 'Planet Earth 客户端已是最新版本。',
|
||||
detail: `外壳版本 / Shell: v${options.shellVersion}\n地球业务包 / Earth Bundle: v${activeBundleVersion}`,
|
||||
buttons: ['确定 / OK'],
|
||||
title: tClient('当前已是最新版本', 'Up to Date'),
|
||||
message: tClient('智能星球客户端已是最新版本。', 'Intelligent Planet is up to date.'),
|
||||
detail: tClient(
|
||||
`当前版本:v${activeBundleVersion}`,
|
||||
`Version: v${activeBundleVersion}`,
|
||||
),
|
||||
buttons: [tClient('确定', 'OK')],
|
||||
})
|
||||
}
|
||||
return
|
||||
@@ -238,13 +248,18 @@ export function createHotUpdateController(options: {
|
||||
|
||||
if (decision.kind === 'hotfix-update') {
|
||||
const { bundle } = decision
|
||||
const notes = bundle.releaseNotes?.trim() ? `\n\n更新内容:\n${bundle.releaseNotes.trim()}` : ''
|
||||
const rawNotes = bundle.releaseNotes?.trim() || ''
|
||||
const notesZh = rawNotes ? `\n\n更新内容:\n${rawNotes}` : ''
|
||||
const notesEn = rawNotes ? `\n\nRelease notes:\n${rawNotes}` : ''
|
||||
const { response } = await showBox({
|
||||
type: 'info',
|
||||
title: '发现新版本 / Update Available',
|
||||
message: `发现 Planet Earth 增量热更新 v${bundle.version}`,
|
||||
detail: `当前地球版本 v${activeBundleVersion} → 最新版本 v${bundle.version}\n更新方式:轻量热更新(无需重新安装,应用后自动生效)${notes}`,
|
||||
buttons: ['立即更新 / Update Now', '稍后提醒 / Later'],
|
||||
title: tClient('发现新版本', 'Update Available'),
|
||||
message: tClient(`发现新版本更新 v${bundle.version}`, `Update v${bundle.version} available`),
|
||||
detail: tClient(
|
||||
`当前版本 v${activeBundleVersion} → 最新版本 v${bundle.version}\n支持在线更新,无需重新安装。${notesZh}`,
|
||||
`Current v${activeBundleVersion} → Latest v${bundle.version}\nOnline update ready, no reinstall required.${notesEn}`,
|
||||
),
|
||||
buttons: [tClient('立即更新', 'Update Now'), tClient('稍后提醒', 'Later')],
|
||||
defaultId: 0,
|
||||
cancelId: 1,
|
||||
})
|
||||
@@ -261,25 +276,33 @@ export function createHotUpdateController(options: {
|
||||
console.error('[planet-client] Hotfix installation failed:', detail)
|
||||
await showBox({
|
||||
type: 'error',
|
||||
title: '热更新失败 / Hotfix Failed',
|
||||
message: `热更新包 v${bundle.version} 下载或校验失败,已保留当前版本运行。`,
|
||||
title: tClient('更新失败', 'Update Failed'),
|
||||
message: tClient(
|
||||
`更新包 v${bundle.version} 下载或校验失败,将继续使用当前版本。`,
|
||||
`Failed to download or verify update v${bundle.version}. Keeping current version.`,
|
||||
),
|
||||
detail,
|
||||
buttons: ['确定 / OK'],
|
||||
buttons: [tClient('确定', 'OK')],
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
const { shell: shellInfo, mandatory } = decision
|
||||
const notes = shellInfo.releaseNotes?.trim() ? `\n\n更新说明:\n${shellInfo.releaseNotes.trim()}` : ''
|
||||
const rawNotes = shellInfo.releaseNotes?.trim() || ''
|
||||
const notesZh = rawNotes ? `\n\n更新说明:\n${rawNotes}` : ''
|
||||
const notesEn = rawNotes ? `\n\nRelease notes:\n${rawNotes}` : ''
|
||||
const { response } = await showBox({
|
||||
type: mandatory ? 'warning' : 'info',
|
||||
title: '发现客户端大版本更新 / Major Client Update',
|
||||
title: tClient('发现客户端重要更新', 'Major Update Available'),
|
||||
message: mandatory
|
||||
? `当前客户端版本 v${options.shellVersion} 过低,需升级至 v${shellInfo.version}`
|
||||
: `发现客户端新版本 v${shellInfo.version}`,
|
||||
detail: `当前客户端外壳:v${options.shellVersion}\n最新版本:v${shellInfo.version}\n该版本包含底层架构或原生壳变更,需下载安装包覆盖更新。${notes}`,
|
||||
buttons: ['前往下载 / Download', '稍后提醒 / Later'],
|
||||
? tClient(`当前版本 v${options.shellVersion} 过低,需升级至 v${shellInfo.version}`, `Current version v${options.shellVersion} requires upgrading to v${shellInfo.version}`)
|
||||
: tClient(`发现客户端新版本 v${shellInfo.version}`, `New version v${shellInfo.version} available`),
|
||||
detail: tClient(
|
||||
`当前版本:v${options.shellVersion}\n最新版本:v${shellInfo.version}\n请下载新版安装包完成升级。${notesZh}`,
|
||||
`Current version: v${options.shellVersion}\nLatest version: v${shellInfo.version}\nPlease download the installer to upgrade.${notesEn}`,
|
||||
),
|
||||
buttons: [tClient('前往下载', 'Download'), tClient('稍后提醒', 'Later')],
|
||||
defaultId: 0,
|
||||
cancelId: 1,
|
||||
})
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
export type ClientLocale = 'zh-CN' | 'en-US'
|
||||
|
||||
let overrideLocale: ClientLocale | null = null
|
||||
|
||||
/**
|
||||
* Normalize any Electron / BCP-47 locale tag to our two supported UI locales.
|
||||
*/
|
||||
export function normalizeClientLocale(raw: unknown): ClientLocale {
|
||||
if (typeof raw !== 'string') return 'zh-CN'
|
||||
const normalized = raw.trim().toLowerCase()
|
||||
if (normalized.startsWith('en')) return 'en-US'
|
||||
return 'zh-CN'
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the active Electron desktop UI locale from explicit override,
|
||||
* environment hint, or Electron app locale when running inside the main process.
|
||||
*/
|
||||
export function getClientLocale(): ClientLocale {
|
||||
if (overrideLocale) return overrideLocale
|
||||
const envLocale = process.env.PLANET_LOCALE || process.env.LANG
|
||||
if (envLocale && envLocale.trim().toLowerCase().startsWith('en')) {
|
||||
return 'en-US'
|
||||
}
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
const electronMod = require('electron') as { app?: { getLocale?: () => string; isReady?: () => boolean } }
|
||||
const appLocale = electronMod?.app?.getLocale?.()
|
||||
if (appLocale) return normalizeClientLocale(appLocale)
|
||||
} catch {
|
||||
// Allow importing in pure Bun unit tests outside Electron runtime.
|
||||
}
|
||||
return 'zh-CN'
|
||||
}
|
||||
|
||||
export function setClientLocale(raw: unknown): ClientLocale {
|
||||
overrideLocale = normalizeClientLocale(raw)
|
||||
return overrideLocale
|
||||
}
|
||||
|
||||
/**
|
||||
* Select pure Chinese or pure English copy for Electron native chrome and dialogs.
|
||||
*/
|
||||
export function tClient(zh: string, en: string): string {
|
||||
return getClientLocale() === 'en-US' ? en : zh
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import { createAdaptiveGpuMonitor, probeWindowsGpuEnvironmentSync } from './gpu-
|
||||
import { buildGpuHandoffArgs, chooseStartupGpuTarget, isGpuProcessCrash, resolveChromiumGpuSwitches, stripGpuOverrideArgs, type ResolvedGpuTarget } from './gpu-policy'
|
||||
import { PERIODIC_UPDATE_CHECK_INTERVAL_MS } from './hot-update-core'
|
||||
import { createHotUpdateController } from './hot-updater'
|
||||
import { tClient } from './i18n'
|
||||
import { buildApplicationMenu } from './menu'
|
||||
import { EARTH_ORIGIN, installEarthSessionHandlers, registerEarthScheme } from './protocol'
|
||||
import { createScreenRecorderController } from './screen-recorder'
|
||||
@@ -250,10 +251,10 @@ if (!singleInstanceLock) {
|
||||
const targetWin = mainWindow && !mainWindow.isDestroyed() ? mainWindow : undefined
|
||||
const boxOptions = {
|
||||
type: 'info' as const,
|
||||
title: '渲染设备设置 / GPU Mode',
|
||||
message: '渲染设备模式已更新,需重启客户端生效',
|
||||
detail: '是否立即重启 Planet Earth?(重启约需 1-2 秒,将保留全部视觉特效)',
|
||||
buttons: ['立即重启 / Restart Now', '稍后手动重启 / Later'],
|
||||
title: tClient('渲染模式设置', 'Graphics Mode'),
|
||||
message: tClient('渲染模式已更改,需重启应用生效', 'Graphics mode updated. Restart to apply.'),
|
||||
detail: tClient('是否立即重启?重启约需 1-2 秒。', 'Restart now? This takes about 1–2 seconds.'),
|
||||
buttons: [tClient('立即重启', 'Restart Now'), tClient('稍后重启', 'Later')],
|
||||
defaultId: 0,
|
||||
cancelId: 1,
|
||||
}
|
||||
|
||||
+49
-40
@@ -3,23 +3,27 @@ import { app, Menu, shell, type BrowserWindow, type MenuItemConstructorOptions }
|
||||
import type { DesktopConfigStore, GpuRenderMode, SplashTheme } from './config'
|
||||
import type { GpuRuntimeSummary } from './gpu-monitor'
|
||||
import type { HotUpdateVersionInfo } from './hot-updater'
|
||||
import { tClient } from './i18n'
|
||||
import type { RecordingStatusSnapshot } from './recording-core'
|
||||
import { openServerSettingsDialog, toggleWindowOrientation } from './window'
|
||||
|
||||
function formatGpuSummaryLabel(summary: GpuRuntimeSummary): string {
|
||||
const targetLabel =
|
||||
summary.activeTarget === 'low-power'
|
||||
? '集成核显'
|
||||
? tClient('节能核显', 'Integrated GPU')
|
||||
: summary.activeTarget === 'software'
|
||||
? 'CPU 软渲染'
|
||||
? tClient('软件兼容渲染', 'Software Rendering')
|
||||
: summary.activeTarget === 'high-performance' || summary.latestVramSample
|
||||
? '独立显卡'
|
||||
: '硬件 GPU'
|
||||
const modeTag = summary.requestedMode === 'auto' ? '自动' : '手动'
|
||||
? tClient('高性能显卡', 'High-Performance GPU')
|
||||
: tClient('硬件加速', 'Hardware GPU')
|
||||
const modeTag = summary.requestedMode === 'auto' ? tClient('自动', 'Auto') : tClient('手动', 'Manual')
|
||||
const vramTag = summary.latestVramSample
|
||||
? ` · 独显空闲 ${(summary.latestVramSample.freeMiB / 1024).toFixed(1)} GB`
|
||||
? tClient(
|
||||
` · 可用显存 ${(summary.latestVramSample.freeMiB / 1024).toFixed(1)} GB`,
|
||||
` · ${(summary.latestVramSample.freeMiB / 1024).toFixed(1)} GB free`,
|
||||
)
|
||||
: ''
|
||||
return `当前生效: ${targetLabel} (${modeTag}${vramTag})`
|
||||
return tClient(`当前运行: ${targetLabel} (${modeTag}${vramTag})`, `Active: ${targetLabel} (${modeTag}${vramTag})`)
|
||||
}
|
||||
|
||||
export function buildApplicationMenu(options: {
|
||||
@@ -89,15 +93,15 @@ export function buildApplicationMenu(options: {
|
||||
]
|
||||
: []),
|
||||
{
|
||||
label: 'Planet Earth',
|
||||
label: tClient('智能星球', 'Intelligent Planet'),
|
||||
submenu: [
|
||||
{
|
||||
label: '重新加载数据 / Reload Data',
|
||||
label: tClient('重新加载数据', 'Reload Data'),
|
||||
accelerator: 'CmdOrCtrl+R',
|
||||
click: () => sendAction('reload-data'),
|
||||
},
|
||||
{
|
||||
label: '服务端连接设置 / Server Settings...',
|
||||
label: tClient('服务器连接设置...', 'Server Settings...'),
|
||||
click: () => {
|
||||
openServerSettingsDialog(options.mainWindow, options.configStore, () => {
|
||||
if (!options.mainWindow.isDestroyed()) {
|
||||
@@ -107,24 +111,24 @@ export function buildApplicationMenu(options: {
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '启动画面 / Splash Screen',
|
||||
label: tClient('启动动画', 'Splash Screen'),
|
||||
submenu: [
|
||||
{
|
||||
label: '启用启动画面 / Enable Splash Screen',
|
||||
label: tClient('启用启动动画', 'Enable Splash Screen'),
|
||||
type: 'checkbox',
|
||||
checked: currentSplashTheme !== 'off',
|
||||
click: () => selectSplashTheme(currentSplashTheme === 'off' ? 'singularity' : 'off'),
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: '立即重播启动画面 / Replay Splash Screen',
|
||||
label: tClient('立即重播启动动画', 'Replay Splash Screen'),
|
||||
accelerator: 'CmdOrCtrl+Shift+S',
|
||||
click: replayActiveSplash,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '渲染设备 / GPU Mode',
|
||||
label: tClient('渲染模式', 'Graphics Mode'),
|
||||
submenu: [
|
||||
...(gpuSummary
|
||||
? [
|
||||
@@ -136,7 +140,7 @@ export function buildApplicationMenu(options: {
|
||||
]
|
||||
: []),
|
||||
{
|
||||
label: '自动(卡顿缺显存切核显,显存空出自动回独显) / Auto',
|
||||
label: tClient('自动切换(推荐)', 'Automatic (Recommended)'),
|
||||
type: 'radio',
|
||||
checked: currentGpuMode === 'auto',
|
||||
click: () => {
|
||||
@@ -144,7 +148,7 @@ export function buildApplicationMenu(options: {
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '独立显卡(高性能) / Discrete GPU',
|
||||
label: tClient('高性能显卡', 'High-Performance GPU'),
|
||||
type: 'radio',
|
||||
checked: currentGpuMode === 'high-performance',
|
||||
click: () => {
|
||||
@@ -152,7 +156,7 @@ export function buildApplicationMenu(options: {
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '集成核显(不占独显显存) / Integrated GPU',
|
||||
label: tClient('节能核显', 'Integrated GPU'),
|
||||
type: 'radio',
|
||||
checked: currentGpuMode === 'low-power',
|
||||
click: () => {
|
||||
@@ -160,7 +164,7 @@ export function buildApplicationMenu(options: {
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '纯 CPU 软渲染 / Software GL',
|
||||
label: tClient('软件兼容渲染', 'Software Rendering'),
|
||||
type: 'radio',
|
||||
checked: currentGpuMode === 'software',
|
||||
click: () => {
|
||||
@@ -170,14 +174,14 @@ export function buildApplicationMenu(options: {
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '录屏 / Screen Recording',
|
||||
label: tClient('录屏', 'Screen Recording'),
|
||||
submenu: [
|
||||
{
|
||||
label: isRecordingOrStopping
|
||||
? '停止录屏 / Stop Recording'
|
||||
? tClient('停止录屏', 'Stop Recording')
|
||||
: recordingState === 'starting'
|
||||
? '正在启动录屏… / Starting…'
|
||||
: '开始录屏 / Start Recording',
|
||||
? tClient('正在启动录屏…', 'Starting Recording…')
|
||||
: tClient('开始录屏', 'Start Recording'),
|
||||
accelerator: 'CmdOrCtrl+Shift+F9',
|
||||
enabled: recordingState === 'idle' || recordingState === 'recording',
|
||||
click: () => {
|
||||
@@ -185,7 +189,7 @@ export function buildApplicationMenu(options: {
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '录制声音 / Include Audio',
|
||||
label: tClient('录制音频', 'Include Audio'),
|
||||
type: 'checkbox',
|
||||
checked: currentRecordAudio,
|
||||
enabled: recordingState === 'idle',
|
||||
@@ -194,7 +198,7 @@ export function buildApplicationMenu(options: {
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '隐藏光标 / Hide Cursor',
|
||||
label: tClient('隐藏光标', 'Hide Cursor'),
|
||||
type: 'checkbox',
|
||||
checked: currentRecordHideCursor,
|
||||
enabled: recordingState === 'idle',
|
||||
@@ -204,7 +208,7 @@ export function buildApplicationMenu(options: {
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: '打开录屏目录 / Open Recordings Folder',
|
||||
label: tClient('打开录屏目录', 'Open Recordings Folder'),
|
||||
click: () => {
|
||||
options.onOpenRecordingsFolder?.()
|
||||
},
|
||||
@@ -213,59 +217,62 @@ export function buildApplicationMenu(options: {
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: '打开运维控制台 / Open Admin Console',
|
||||
label: tClient('打开管理控制台', 'Open Admin Console'),
|
||||
click: () => openAdminPath('/admin'),
|
||||
},
|
||||
{
|
||||
label: '打开操作文档 / Open Documentation',
|
||||
label: tClient('打开帮助文档', 'Open Documentation'),
|
||||
click: () => openAdminPath('/docs/manual'),
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: '检查更新 / Check for Updates...',
|
||||
label: tClient('检查更新...', 'Check for Updates...'),
|
||||
click: () => options.onCheckForUpdates?.(),
|
||||
},
|
||||
...(options.getVersionInfo
|
||||
? [
|
||||
(() => {
|
||||
const info = options.getVersionInfo!()
|
||||
const suffix = info.usingHotfix ? ' (热更 / Hotfix)' : ''
|
||||
const suffix = info.usingHotfix ? tClient('(已更新)', ' (Updated)') : ''
|
||||
return {
|
||||
label: `当前版本: Shell v${info.shellVersion} · Earth v${info.activeBundleVersion}${suffix}`,
|
||||
label: tClient(
|
||||
`当前版本: v${info.activeBundleVersion}${suffix}`,
|
||||
`Version: v${info.activeBundleVersion}${suffix}`,
|
||||
),
|
||||
enabled: false,
|
||||
}
|
||||
})(),
|
||||
]
|
||||
: []),
|
||||
{ type: 'separator' },
|
||||
{ role: 'quit', label: '退出 / Quit' },
|
||||
{ role: 'quit', label: tClient('退出', 'Quit') },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '视图 / View',
|
||||
label: tClient('视图', 'View'),
|
||||
submenu: [
|
||||
{
|
||||
label: '放大视角 / Zoom In',
|
||||
label: tClient('放大视角', 'Zoom In'),
|
||||
accelerator: 'CmdOrCtrl+=',
|
||||
click: () => sendAction('zoom-in'),
|
||||
},
|
||||
{
|
||||
label: '缩小视角 / Zoom Out',
|
||||
label: tClient('缩小视角', 'Zoom Out'),
|
||||
accelerator: 'CmdOrCtrl+-',
|
||||
click: () => sendAction('zoom-out'),
|
||||
},
|
||||
{
|
||||
label: '重置缩放 / Reset Zoom (100%)',
|
||||
label: tClient('重置缩放 (100%)', 'Reset Zoom (100%)'),
|
||||
accelerator: 'CmdOrCtrl+0',
|
||||
click: () => sendAction('zoom-reset'),
|
||||
},
|
||||
{
|
||||
label: '重置地球视角 / Reset View',
|
||||
label: tClient('重置地球视角', 'Reset View'),
|
||||
click: () => sendAction('reset-view'),
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: '切换横竖屏 / Toggle Portrait & Landscape',
|
||||
label: tClient('切换横竖屏', 'Toggle Portrait & Landscape'),
|
||||
accelerator: 'CmdOrCtrl+Shift+M',
|
||||
click: () => {
|
||||
if (!options.mainWindow.isDestroyed()) {
|
||||
@@ -274,7 +281,9 @@ export function buildApplicationMenu(options: {
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '切换全屏 / Toggle Fullscreen (F11)',
|
||||
label: process.platform === 'darwin'
|
||||
? tClient('切换全屏', 'Toggle Fullscreen')
|
||||
: tClient('切换全屏 (F11)', 'Toggle Fullscreen (F11)'),
|
||||
// Keep accelerator unregistered on Win/Linux so controls.js F11 shortcut never double-toggles.
|
||||
...(process.platform === 'darwin' ? { accelerator: 'Ctrl+Command+F' } : {}),
|
||||
click: () => {
|
||||
@@ -284,12 +293,12 @@ export function buildApplicationMenu(options: {
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '显示/隐藏帧率 / Toggle FPS',
|
||||
label: tClient('显示或隐藏帧率', 'Toggle FPS'),
|
||||
click: () => sendAction('toggle-fps'),
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: '开发者工具 / Toggle DevTools',
|
||||
label: tClient('开发者工具', 'Toggle DevTools'),
|
||||
accelerator: 'F12',
|
||||
click: () => {
|
||||
if (!options.mainWindow.isDestroyed()) {
|
||||
|
||||
@@ -119,9 +119,13 @@ export function computeIndicatorBounds(options: {
|
||||
/**
|
||||
* Render self-contained HTML for the transparent floating recording indicator pill.
|
||||
*/
|
||||
export function buildRecordingIndicatorHtml(): string {
|
||||
export function buildRecordingIndicatorHtml(locale: 'zh-CN' | 'en-US' = 'zh-CN'): string {
|
||||
const isEn = locale === 'en-US'
|
||||
const shortcut = process.platform === 'darwin' ? 'Cmd+Shift+F9' : 'Ctrl+Shift+F9'
|
||||
const stopTitle = isEn ? `Stop recording (${shortcut})` : `点击停止录屏 (${shortcut})`
|
||||
const stopAria = isEn ? 'Stop recording' : '停止录屏'
|
||||
return `<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<html lang="${locale}">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<style>
|
||||
@@ -214,7 +218,7 @@ export function buildRecordingIndicatorHtml(): string {
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<button id="rec-stop-btn" class="rec-pill" type="button" title="点击停止录屏 (Ctrl+Shift+F9)" aria-label="停止录屏">
|
||||
<button id="rec-stop-btn" class="rec-pill" type="button" title="${stopTitle}" aria-label="${stopAria}">
|
||||
<span class="rec-glyph-wrap" aria-hidden="true"><span class="rec-glyph"></span></span>
|
||||
<span id="rec-timer" class="rec-time">00:00</span>
|
||||
</button>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { BrowserWindow } from 'electron'
|
||||
import { BrowserWindow, screen, type Display } from 'electron'
|
||||
|
||||
import { getClientLocale } from './i18n'
|
||||
import { buildRecordingIndicatorHtml, computeIndicatorBounds, formatRecordingDuration } from './recording-core'
|
||||
|
||||
export interface RecordingIndicatorController {
|
||||
@@ -162,7 +163,9 @@ export function createRecordingIndicatorController(options: {
|
||||
syncBoundsAndLevel()
|
||||
}
|
||||
})
|
||||
void indicatorWin.loadURL(`data:text/html;charset=utf-8,${encodeURIComponent(buildRecordingIndicatorHtml())}`)
|
||||
void indicatorWin.loadURL(
|
||||
`data:text/html;charset=utf-8,${encodeURIComponent(buildRecordingIndicatorHtml(getClientLocale()))}`,
|
||||
)
|
||||
return indicatorWin
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
} from 'electron'
|
||||
|
||||
import type { DesktopConfigStore } from './config'
|
||||
import { tClient } from './i18n'
|
||||
import {
|
||||
buildRecordingFilename,
|
||||
resolveRecordingExtension,
|
||||
@@ -230,7 +231,7 @@ export function createScreenRecorderController(options: {
|
||||
writeChain = Promise.resolve()
|
||||
writeStream = fs.createWriteStream(filePath)
|
||||
writeStream.on('error', (err) => {
|
||||
notifyStatus(`录屏写入失败:${err.message}`, 'error')
|
||||
notifyStatus(tClient(`录屏写入失败:${err.message}`, `Recording write failed: ${err.message}`), 'error')
|
||||
})
|
||||
|
||||
startedAtMs = Date.now()
|
||||
@@ -298,15 +299,15 @@ export function createScreenRecorderController(options: {
|
||||
if (result.savedPath && result.savedName && result.hadData) {
|
||||
lastSavedFilePath = result.savedPath
|
||||
notifyStatus({
|
||||
message: `已保存录屏:${result.savedPath}`,
|
||||
message: tClient(`已保存录屏:${result.savedPath}`, `Recording saved: ${result.savedPath}`),
|
||||
type: 'success',
|
||||
fullText: true,
|
||||
durationMs: 6000,
|
||||
actionLabel: '打开目录',
|
||||
actionLabel: tClient('打开目录', 'Open Folder'),
|
||||
action: 'open-recordings-folder',
|
||||
})
|
||||
} else if (state !== 'idle') {
|
||||
notifyStatus('录屏已停止(未采集到有效画面帧)', 'info')
|
||||
notifyStatus(tClient('录屏已停止(未采集到有效画面帧)', 'Recording stopped (no valid frames captured)'), 'info')
|
||||
}
|
||||
resetToIdle()
|
||||
return result
|
||||
@@ -315,14 +316,14 @@ export function createScreenRecorderController(options: {
|
||||
const onAbort = async (_event: Electron.IpcMainInvokeEvent, payload?: { error?: string }) => {
|
||||
await closeWriteStream()
|
||||
if (payload?.error) {
|
||||
notifyStatus(`启动录屏失败:${payload.error}`, 'error')
|
||||
notifyStatus(tClient(`启动录屏失败:${payload.error}`, `Failed to start recording: ${payload.error}`), 'error')
|
||||
}
|
||||
resetToIdle()
|
||||
}
|
||||
|
||||
const onAudioFallback = () => {
|
||||
includeAudio = false
|
||||
notifyStatus('当前设备不支持内录音频,已切换为静音录屏', 'info')
|
||||
notifyStatus(tClient('当前设备不支持音频录制,已切换为静音录屏', 'System audio capture unavailable; recording muted'), 'info')
|
||||
}
|
||||
|
||||
const onIndicatorStop = () => {
|
||||
|
||||
+11
-10
@@ -6,6 +6,7 @@ import { BrowserWindow, ipcMain, nativeTheme, screen, shell, type Display } from
|
||||
import { createSoloAltMenuTracker } from './alt-menu'
|
||||
import { DEFAULT_ENDPOINTS, type DesktopConfigStore, type DesktopRuntimeConfig } from './config'
|
||||
import { resolveExternalTargetUrl } from './external-links'
|
||||
import { getClientLocale, tClient } from './i18n'
|
||||
import { createWindowShowGate } from './show-gate'
|
||||
import {
|
||||
clampBoundsToWorkArea,
|
||||
@@ -496,7 +497,7 @@ export function openServerSettingsDialog(
|
||||
maximizable: false,
|
||||
autoHideMenuBar: true,
|
||||
backgroundColor: '#091522',
|
||||
title: 'Planet Earth — Server Connection',
|
||||
title: tClient('服务器连接设置', 'Server Connection Settings'),
|
||||
webPreferences: {
|
||||
contextIsolation: true,
|
||||
nodeIntegration: false,
|
||||
@@ -509,7 +510,7 @@ export function openServerSettingsDialog(
|
||||
value.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>')
|
||||
|
||||
const html = `<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<html lang="${getClientLocale()}">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<style>
|
||||
@@ -528,23 +529,23 @@ export function openServerSettingsDialog(
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2>服务端连接配置 / Server Connection</h2>
|
||||
<h2>${tClient('服务器连接设置', 'Server Connection Settings')}</h2>
|
||||
<form id="cfg">
|
||||
<label>后端服务地址 (Backend API URL)
|
||||
<label>${tClient('服务器地址', 'Backend API URL')}
|
||||
<input name="backendUrl" type="url" required value="${escapeAttr(current.backendUrl)}">
|
||||
</label>
|
||||
<label>运维控制台地址 (Admin Console URL)
|
||||
<label>${tClient('管理控制台地址', 'Admin Console URL')}
|
||||
<input name="adminUrl" type="url" required value="${escapeAttr(current.adminUrl)}">
|
||||
</label>
|
||||
<label>本地动捕 WebSocket (Motion Agent WS URL)
|
||||
<label>${tClient('动捕服务地址', 'Motion Service WS URL')}
|
||||
<input name="motionWsUrl" type="text" required value="${escapeAttr(current.motionWsUrl)}">
|
||||
</label>
|
||||
<div id="err" class="error" aria-live="polite"></div>
|
||||
<div class="actions">
|
||||
<button type="button" id="defaults">恢复默认 / Defaults</button>
|
||||
<button type="button" id="defaults">${tClient('恢复默认', 'Reset Defaults')}</button>
|
||||
<div class="actions-right">
|
||||
<button type="button" id="cancel">取消 / Cancel</button>
|
||||
<button type="submit" class="primary">保存并重连 / Save</button>
|
||||
<button type="button" id="cancel">${tClient('取消', 'Cancel')}</button>
|
||||
<button type="submit" class="primary">${tClient('保存并重连', 'Save & Reconnect')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -578,7 +579,7 @@ export function openServerSettingsDialog(
|
||||
!isValidUrl(adminUrl, ['http:', 'https:']) ||
|
||||
!isValidUrl(motionWsUrl, ['ws:', 'wss:'])
|
||||
) {
|
||||
errEl.textContent = '请输入有效地址 (http/https 与 ws/wss) / Enter valid URLs.';
|
||||
errEl.textContent = ${JSON.stringify(tClient('请输入有效的服务器地址(支持 http/https 与 ws/wss)。', 'Enter valid URLs (http/https and ws/wss).'))};
|
||||
return;
|
||||
}
|
||||
const q = new URLSearchParams({ backendUrl, adminUrl, motionWsUrl });
|
||||
|
||||
@@ -752,6 +752,7 @@ export function createDesktopSplashController(options: {
|
||||
const styleEl = document.createElement('style')
|
||||
styleEl.textContent = SPLASH_CSS
|
||||
|
||||
const isEn = getLocaleIsEn()
|
||||
const root = document.createElement('div')
|
||||
root.className = 'splash-root'
|
||||
root.dataset.theme = activeTheme
|
||||
@@ -760,16 +761,16 @@ export function createDesktopSplashController(options: {
|
||||
<header class="splash-topbar">
|
||||
<div class="splash-telemetry-tag">
|
||||
<span class="splash-telemetry-dot"></span>
|
||||
<span>PLANET EARTH // HOLOGRAPHIC PERCEPTION KERNEL</span>
|
||||
<span>${isEn ? 'INTELLIGENT PLANET // 3D EARTH KERNEL' : '智能星球 // 三维地球核心'}</span>
|
||||
</div>
|
||||
<div class="splash-controls">
|
||||
<button type="button" class="splash-skip" data-splash-skip title="跳过启动动画 (Esc)">ESC 跳过</button>
|
||||
<button type="button" class="splash-skip" data-splash-skip title="${isEn ? 'Skip splash screen (Esc)' : '跳过启动动画 (Esc)'}">${isEn ? 'ESC SKIP' : 'ESC 跳过'}</button>
|
||||
</div>
|
||||
</header>
|
||||
<footer class="splash-footer">
|
||||
<div class="splash-brand-head">
|
||||
<h1 class="splash-title">智能星球计划</h1>
|
||||
<div class="splash-subtitle">INTELLIGENT PLANET PROGRAM</div>
|
||||
<h1 class="splash-title">${isEn ? 'INTELLIGENT PLANET' : '智能星球计划'}</h1>
|
||||
${isEn ? '' : '<div class="splash-subtitle">全球基础设施与空间态势引擎</div>'}
|
||||
</div>
|
||||
<div class="splash-progress-box">
|
||||
<div class="splash-progress-meta">
|
||||
@@ -781,12 +782,11 @@ export function createDesktopSplashController(options: {
|
||||
</div>
|
||||
</div>
|
||||
<div class="splash-presenter">
|
||||
<img class="splash-zju-emblem" src="planet://earth/earth/assets/brand/zju-emblem.png" alt="浙江大学">
|
||||
<img class="splash-zju-emblem" src="planet://earth/earth/assets/brand/zju-emblem.png" alt="${isEn ? 'Zhejiang University' : '浙江大学'}">
|
||||
<div class="splash-presenter-divider" aria-hidden="true"></div>
|
||||
<div class="splash-presenter-copy">
|
||||
<span class="splash-presenter-kicker">PRESENTED BY</span>
|
||||
<span class="splash-presenter-zh">临空智能媒体研究院</span>
|
||||
<span class="splash-presenter-en">Intelligent Media Institute</span>
|
||||
<span class="splash-presenter-kicker">${isEn ? 'PRESENTED BY' : '联合研制'}</span>
|
||||
<span class="${isEn ? 'splash-presenter-en' : 'splash-presenter-zh'}">${isEn ? 'Linkong Intelligent Media Institute' : '临空智能媒体研究院'}</span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
Reference in new issue
Block a user