Repository navigation
Feature/translate - #19
Merged
Merged
Conversation
- Provider 桥接:原生层(任意 native 线程)可反向调用 JS 侧注册的方法(翻译/OCR 等 provider) - 截图翻译(Windows):编辑态工具栏新增「翻译」按钮,原生编排 OCR(行级坐标)→ 逐行翻译 → 译文覆盖原文字区域 - 翻译聚类算法(translate_cluster)将 OCR 行块聚合为段落级译区,减少覆盖碎块 - 新增轻量 logger 及 JS 绑定,便于原生层日志输出 - 新增 test-translate / test-provider-bridge / test-logger 测试与 translate-cluster 自测工具
- Provider 桥(provider_bridge.h)新增异步通路:InvokeAsync/CancelAsync 按 requestId 受理与取消,与同步 Invoke 共用 pending 表与 seq 序号空间, 取消/超时后晚到的 JS 回传按 seq 落空静默丢弃;双平台导出 invokeProviderAsyncFromNative/cancelProviderAsyncFromNative, JS 侧新增 ProviderBridge.invokeFromNativeAsync - macOS 新增截图翻译(ScreenshotTranslateMac.swift + translate_bridge_mac C ABI shim):全异步状态机(OCR → 聚类 → 有限并发逐段翻译 → 布局渲染), 经 ztoolsRegisterNativeBridge 注入的原生桥函数指针发起 provider 异步调用, 结果经 ztoolsSwiftProviderResultHandler 回投;构建脚本与 CI 同步纳入新源 - macOS 截图会话改为非阻塞生命周期:start() 立即返回,AppKit 事件与周期任务 由宿主主事件循环驱动(Electron 主进程为标准宿主),会话期间可用本进程定时器 触发 abortLongCapture;新增 test/electron-host.cjs 验收宿主 - Windows 译文字号搜索简化为 min(装进段框的最大字号, 原文行距对应字号), 移除行宽利用率/垂直密度对齐;OCR 仅回整段 text 时改走整图兜底不再误报无文字 - 取色器保存并恢复宿主激活策略(修复 Electron 宿主 Dock 图标被永久隐藏); logger.h 修复 std::gettimeofday 在 macOS 工具链不可编译 - 新增 Provider 异步桥端到端测试(test-provider-async-bridge.js),README 补充双平台截图翻译与 macOS 非阻塞会话说明
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
实现了供应商接入截图翻译工具