Skip to content

feat: add quick region OCR and selected-text translation - #7

Open
xysamuel wants to merge 2 commits into
thinkany-ai:devfrom
xysamuel:feat/quick-ocr-selected-text-translation
Open

xysamuel wants to merge 2 commits into
thinkany-ai:devfrom
xysamuel:feat/quick-ocr-selected-text-translation

Conversation

@xysamuel

Copy link
Copy Markdown
Contributor

Summary

Adds two standalone text-action workflows alongside Snapok's existing image OCR and image translation:

  • Quick region OCR (Control–Option–O): drag and release to recognize text locally with Apple Vision; choose preserved line breaks, smart paragraphs, or a single line.
  • Selected-text translation (Control–Option–Shift–O): read accessible text selected in another application and translate using Baidu General Text Translation or the system on-device provider.
  • Add configurable automatic copying, translucent multiline side notices, sound, editable results, and a menu action to review the last result.
  • Add settings for providers, target languages, credentials, connection testing, language-pack preparation, and shortcuts; include English/Chinese UI, focused tests, and usage/privacy documentation.

Region OCR extracts text only; it does not automatically translate the captured region. This PR does not claim to introduce OCR or translation to Snapok for the first time.

Permissions, privacy, and compatibility

  • Region capture uses Screen Recording permission; selected-text access uses Accessibility permission and depends on the source application exposing its selection.
  • Region recognition stays local. Baidu translation sends selected text to Baidu over HTTPS and requires the user's own APP ID and secret; service quotas/charges may apply.
  • Credentials use Keychain storage. Connection testing is explicit and separate from saving settings.
  • The system text-translation implementation requires macOS 26+ and installed language packs.

Scope

Based on upstream dev at c7012ac. Contains 12 files: 11 feature/integration/test files and one usage document.

Explicitly excludes local code-signing certificate lookup/fallback changes, developer install/start scripts, local permission resets, unrelated component-snapping changes, and scrolling-stitch test changes. No dependency changes.

Validation

  • Final staged git diff --check passed.
  • Reviewed the isolated file list and integration diff; checked for private-key/token patterns, local paths, and local signing artifacts.
  • Published tree and commit hashes exactly match the reviewed local commit.
  • Build and automated-test success is not claimed: the interrupted session records invocations of the hotkey, localization, image-translation checks and swift build -c debug, but their final exit statuses/output were not retained in the resumed session. They were not rerun during this continuation.
  • Reconfirm bash scripts/test-ocr.sh (default-language and English passes) and regression scripts in a reproducible environment.
  • Manual release checks: multi-display capture, Escape cancellation, denied permissions, inaccessible selections, shortcut conflicts, and live translation with both providers.

The OCR suite uses injected translation functions and isolated pasteboards; it does not replace live-provider, language-pack, or cross-application permission testing.

Documentation

See docs/text-actions.md for usage, privacy, defaults, limitations, and testing instructions.

@xysamuel xysamuel closed this Oct 15, 2026
@xysamuel
xysamuel deleted the feat/quick-ocr-selected-text-translation branch October 15, 2026 13:50
Add Control-Option-T region translation and library screenshot text translation using the rendered image. Keep OCR intermediates out of the clipboard on failure or cancellation.

Validation: swift build; OCR/translation checks (157 each in default and English); hotkey, history, image translation and image translation integration scripts passed. Live translation providers and multi-display capture still require manual acceptance.
@xysamuel xysamuel reopened this Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant