feat(next-macos-native): i18n message board and system tool chrome

Localize message board toolbar, editor hints, and fullscreen window title; hardware/code-run/net tool labels and status (zh-CN / en-US / ja-JP). Update parity.md.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
RememBerBerandCursor committed 2026-09-16 17:46:45 +08:00
1 parent fcbab5bca9
commit ba444fdf5e
5 files changed
+73 -22

No files matched your search

@@ -6,6 +6,7 @@ struct MessageBoardTool: View {
@Bindable var draft: ToolDraft
@Environment(\.appLanguage) private var language
@State private var presenter = MessageBoardFullscreenPresenter()
private func loc(_ key: String) -> String { AppLocalization.string(key, language: language) }
private var board: Binding<MessageBoardOptions> {
Binding(
get: {
@@ -20,7 +21,7 @@ struct MessageBoardTool: View {
let foreground = MessageBoardColorCoding.color(hex: options.foregroundHex) ?? .black
let textAlignment: TextAlignment = options.alignment == "left" ? .leading : .center
ToolPage(tool: Catalog.tool("messageBoard"), draft: draft) {
Menu("常用留言") {
Menu(loc("messageBoard.presets")) {
ForEach(MessageBoardThemes.presets, id: \.title) { preset in
Button(preset.title) {
draft.input = preset.message
@@ -29,15 +30,15 @@ struct MessageBoardTool: View {
}
}
}
Picker("对齐", selection: Binding(get: { board.wrappedValue.alignment }, set: { board.wrappedValue.alignment = $0 })) {
Text("居中").tag("center")
Text("左对齐").tag("left")
Picker(loc("messageBoard.alignment"), selection: Binding(get: { board.wrappedValue.alignment }, set: { board.wrappedValue.alignment = $0 })) {
Text(loc("messageBoard.alignCenter")).tag("center")
Text(loc("messageBoard.alignLeft")).tag("left")
}.frame(width: 140)
ColorPicker("背景", selection: Binding(
ColorPicker(loc("messageBoard.background"), selection: Binding(
get: { background },
set: { board.wrappedValue.backgroundHex = MessageBoardColorCoding.hex($0) }))
.frame(width: 90)
ColorPicker("文字", selection: Binding(
ColorPicker(loc("messageBoard.foreground"), selection: Binding(
get: { foreground },
set: { board.wrappedValue.foregroundHex = MessageBoardColorCoding.hex($0) }))
.frame(width: 90)
@@ -49,14 +50,15 @@ struct MessageBoardTool: View {
size: board.wrappedValue.fontSize,
background: background,
foreground: foreground,
alignment: textAlignment)
alignment: textAlignment,
windowTitle: loc("messageBoard.windowTitle"))
}
} content: {
VStack(spacing: 14) {
TextField("写下你的留言", text: $draft.input).textFieldStyle(.roundedBorder).font(.title3)
TextField(loc("messageBoard.placeholder"), text: $draft.input).textFieldStyle(.roundedBorder).font(.title3)
BoardDisplay(text: draft.input, size: board.wrappedValue.fontSize, background: background, foreground: foreground, alignment: textAlignment)
.clipShape(RoundedRectangle(cornerRadius: 16))
Text("全屏展示时按 Esc 退出;展示期间会阻止显示器休眠。").font(.caption).foregroundStyle(.secondary)
Text(loc("messageBoard.hint")).font(.caption).foregroundStyle(.secondary)
}
}
.onAppear {
@@ -8,14 +8,14 @@ final class MessageBoardFullscreenPresenter: NSObject, NSWindowDelegate {
private var keyMonitor: Any?
private var assertionID: IOPMAssertionID = 0
func present(text: String, size: Double, background: Color, foreground: Color, alignment: TextAlignment) {
func present(text: String, size: Double, background: Color, foreground: Color, alignment: TextAlignment, windowTitle: String) {
dismiss()
let panel = NSWindow(
contentRect: NSRect(x: 0, y: 0, width: 1100, height: 720),
styleMask: [.titled, .closable, .resizable, .miniaturizable],
backing: .buffered,
defer: false)
panel.title = "MooTool Native · 留言板"
panel.title = windowTitle
panel.isReleasedWhenClosed = false
panel.delegate = self
panel.contentView = NSHostingView(rootView: BoardDisplay(text: text, size: size, background: background, foreground: foreground, alignment: alignment))
@@ -6,30 +6,31 @@ struct SystemTool: View {
@Bindable var draft: ToolDraft
@Environment(AppStore.self) private var store
@Environment(\.appLanguage) private var language
private func loc(_ key: String) -> String { AppLocalization.string(key, language: language) }
var body: some View {
ToolPage(tool: Catalog.tool(id), draft: draft) {
if id == "java" {
Picker("语言", selection: $draft.mode) { ForEach(["Python", "JavaScript", "Swift", "Java", "Groovy"], id: \.self) { Text($0) } }.frame(width: 165)
Picker(loc("codeRun.language"), selection: $draft.mode) { ForEach(["Python", "JavaScript", "Swift", "Java", "Groovy"], id: \.self) { Text($0) } }.frame(width: 165)
PrimaryButton(title: AppLocalization.string("tool.runCode", language: language), action: run)
Button(AppLocalization.string("tool.example", language: language)) { draft.input = example }
Text("使用本机运行时 · 最长 20 秒").font(.caption).foregroundStyle(.secondary)
Text(loc("codeRun.runtimeHint")).font(.caption).foregroundStyle(.secondary)
} else if id == "net" {
Picker("工具", selection: $draft.mode) { ForEach(["DNS", "Ping", "Whois", "网络接口"], id: \.self) { Text($0) } }.frame(width: 150)
TextField("域名或 IP", text: $draft.input).textFieldStyle(.roundedBorder).frame(minWidth: 180, maxWidth: 400)
Picker(loc("net.tool"), selection: $draft.mode) { ForEach(["DNS", "Ping", "Whois", "网络接口"], id: \.self) { Text($0) } }.frame(width: 150)
TextField(loc("net.hostPlaceholder"), text: $draft.input).textFieldStyle(.roundedBorder).frame(minWidth: 180, maxWidth: 400)
PrimaryButton(title: AppLocalization.string("tool.query", language: language), action: run)
} else {
PrimaryButton(title: AppLocalization.string("tool.refreshSystemInfo", language: language), symbol: "arrow.clockwise", action: run)
Button("详细硬件报告") { draft.mode = "详细"; run() }
Button(loc("hardware.detailedReport")) { draft.mode = "详细"; run() }
}
} content: {
if id == "java" {
PersistedHSplit(toolID: "java", defaultLeading: 420, minLeading: 280, maxLeading: 900) {
EditorPane(title: "代码", text: $draft.input)
EditorPane(title: loc("tool.input"), text: $draft.input)
} trailing: {
EditorPane(title: "输出", text: $draft.output, editable: false)
EditorPane(title: loc("tool.output"), text: $draft.output, editable: false)
}
} else {
EditorPane(title: id == "hardware" ? "此 Mac" : "输出", text: $draft.output, editable: false)
EditorPane(title: id == "hardware" ? loc("hardware.thisMac") : loc("tool.output"), text: $draft.output, editable: false)
}
}.onAppear {
if draft.mode.isEmpty { draft.mode = id == "java" ? "Python" : "DNS" }
@@ -87,7 +88,7 @@ struct SystemTool: View {
if mode == "详细" { text += "\n" + (try await ProcessRunner.run(executable: "/usr/sbin/system_profiler", arguments: ["SPHardwareDataType", "SPDisplaysDataType"], timeout: 30)) }
output = text
}
draft.output = output; draft.status = "已完成"; if id != "hardware" { store.record(id) }
draft.output = output; draft.status = loc("tool.status.done"); if id != "hardware" { store.record(id) }
} catch { draft.error = error.localizedDescription }
}
}
@@ -346,6 +346,22 @@ public enum AppLocalization {
"reformat.status.opened": "已打开 %@",
"reformat.status.copied": "已复制当前内容",
"reformat.status.cleared": "已清空",
"messageBoard.presets": "常用留言",
"messageBoard.alignment": "对齐",
"messageBoard.alignCenter": "居中",
"messageBoard.alignLeft": "左对齐",
"messageBoard.background": "背景",
"messageBoard.foreground": "文字",
"messageBoard.placeholder": "写下你的留言",
"messageBoard.hint": "全屏展示时按 Esc 退出;展示期间会阻止显示器休眠。",
"messageBoard.windowTitle": "MooTool Native · 留言板",
"hardware.detailedReport": "详细硬件报告",
"hardware.thisMac": "此 Mac",
"tool.status.done": "已完成",
"codeRun.language": "语言",
"codeRun.runtimeHint": "使用本机运行时 · 最长 20 秒",
"net.tool": "工具",
"net.hostPlaceholder": "域名或 IP",
"palette.cancel": "取消",
"palette.hint": "↑ ↓ 选择 · ↩ 打开 · Esc 关闭",
"palette.count": "个工具",
@@ -695,6 +711,22 @@ public enum AppLocalization {
"reformat.status.opened": "Opened %@",
"reformat.status.copied": "Copied current content",
"reformat.status.cleared": "Cleared",
"messageBoard.presets": "Presets",
"messageBoard.alignment": "Alignment",
"messageBoard.alignCenter": "Center",
"messageBoard.alignLeft": "Left",
"messageBoard.background": "Background",
"messageBoard.foreground": "Text",
"messageBoard.placeholder": "Your message",
"messageBoard.hint": "Press Esc to exit fullscreen; display sleep is prevented while presenting.",
"messageBoard.windowTitle": "MooTool Native · Message Board",
"hardware.detailedReport": "Detailed hardware report",
"hardware.thisMac": "This Mac",
"tool.status.done": "Done",
"codeRun.language": "Language",
"codeRun.runtimeHint": "Uses local runtimes · 20s max",
"net.tool": "Tool",
"net.hostPlaceholder": "Host or IP",
"palette.cancel": "Cancel",
"palette.hint": "↑ ↓ select · ↩ open · Esc close",
"palette.count": "tools",
@@ -1044,6 +1076,22 @@ public enum AppLocalization {
"reformat.status.opened": "%@ を開きました",
"reformat.status.copied": "現在の内容をコピーしました",
"reformat.status.cleared": "クリアしました",
"messageBoard.presets": "プリセット",
"messageBoard.alignment": "配置",
"messageBoard.alignCenter": "中央",
"messageBoard.alignLeft": "左",
"messageBoard.background": "背景",
"messageBoard.foreground": "文字",
"messageBoard.placeholder": "メッセージを入力",
"messageBoard.hint": "全画面表示中は Esc で終了。表示中はディスプレイのスリープを抑止します。",
"messageBoard.windowTitle": "MooTool Native · メッセージボード",
"hardware.detailedReport": "詳細ハードウェアレポート",
"hardware.thisMac": "この Mac",
"tool.status.done": "完了",
"codeRun.language": "言語",
"codeRun.runtimeHint": "ローカルランタイム · 最大 20 秒",
"net.tool": "ツール",
"net.hostPlaceholder": "ホストまたは IP",
"palette.cancel": "キャンセル",
"palette.hint": "↑ ↓ 選択 · ↩ 開く · Esc 閉じる",
"palette.count": "件のツール",
+2 -2
View File
@@ -25,13 +25,13 @@
| Cron | 五段 Unix 与六/七段 Quartz(`?`、MON–SUN、秒字段)、`L`/`W`/`#`(月末、最近工作日、第 N 个/最后一个周几)、构建器与常用预设、中文字段说明、常见表达式自然语言摘要、时区选择与下十次执行时间 | 完整 cronstrue 级自然语言、复杂 `L/W` 组合与列表混写;按所选时区计算 |
| 二维码 | Core Image 生成、四级纠错、含静区 PNG、Vision 图片识别;工具栏、空状态与识别结果区主文案支持三语 | 摄像头、Logo、批量或其他条码;错误提示仍为中文 |
| 时间转换 | 与 Electron 对齐的当前时间带、时区选择与快捷区、时间戳↔本地时间双向转换(秒/毫秒单位)、大时钟浮层、历史记录;面板主文案与历史摘要支持 zh-CN / en-US / ja-JP;「详细解析」保留 ISO 8601/日期文本及秒毫秒/UTC 多行输出 | 独立全屏 Portal 动效;解析/校验错误信息仍为系统或中文;13 位及以上数字按毫秒解析(与 Electron 一致),更短毫秒戳请用手动单位或 ISO |
| 留言板 | 预设文案(含主题色)、字号、左/居中对齐、前景/背景、草稿持久化、自适应预览、独立全屏窗口、Esc 退出、展示时阻止显示器休眠 | 与 Electron 一致的完整主题面板、字号百分比自适应算法与入场动画 |
| 留言板 | 预设文案(含主题色)、字号、左/居中对齐、前景/背景、草稿持久化、自适应预览、独立全屏窗口、Esc 退出、展示时阻止显示器休眠;工具栏与编辑区主控件支持三语 | 与 Electron 一致的完整主题面板、字号百分比自适应算法与入场动画;预设菜单项标题与默认文案仍为中文 |
| 翻译 | 与 Electron 相同的「翻译 / 词库 / 历史」标签;macOS 15+ 系统 Translation、分栏原文/译文(`translation`)与词库分栏(`translation-words`);词条写入 `workspace.json`;系统词典入口;SQLite 词条/历史可合并导入 | 第三方翻译供应商;macOS 14 无系统 Translation,仍可使用词库/历史与词典 |
| 计算器 | 运算优先级、幂、科学计数、常用函数、常量、64 位进制转换 | 任意精度、单位换算;三角函数使用弧度 |
| 调色板 | 系统 ColorPicker、屏幕取色、HEX/RGB/HSL/SwiftUI;颜色/正则/Cron **收藏**(`toolFavorites`,与 Electron 收藏夹语义一致);工具栏与结果栏主控件及 HEX 校验提示支持三语 | 全部色彩空间和 Electron 的配色功能;收藏夹分组 UI 较简;颜色值输出块标签仍为英文 |
| 图片工具 | 拖放、预览、可拖动分栏(预览 / 导出选项)、比例缩放、PNG/JPEG/TIFF、JPEG 质量、文字水印、系统截图;工具栏与导出侧栏主控件支持三语;分栏宽度写入 `workspace.json` | 批处理、多图库列表、矢量化、复杂编辑;导出新位图,不保留原 EXIF/色彩配置/动画帧;错误提示仍为中文 |
| PDF | PDFKit 预览、多文件排序合并、页码提取、文本提取和导出;工具栏与列表面板主控件支持三语 | OCR、密码处理、复杂压缩/水印;重建页面不保留原文档的书签和签名;错误提示仍为中文 |
| 系统信息 | OS、CPU 核数、内存、运行时间、磁盘、system_profiler 详细信息 | 持续传感器监控和 Electron 全部硬件指标 |
| 系统信息 | OS、CPU 核数、内存、运行时间、磁盘、system_profiler 详细信息;刷新/详细报告按钮与输出区标题支持三语 | 持续传感器监控和 Electron 全部硬件指标;system_profiler 与摘要字段标签仍为英文/中文混排 |
## 工作台