Conversation
Settings → Translation (off by default) translates chats in apps the user picks (WhatsApp, Teams, Telegram, Slack, Outlook, Mail, Messages): - Incoming: every 2 s, and right after scrolling, TranslationCoordinator captures the frontmost chat window (new captureActiveWindow), reads it with Vision OCR using language hints, groups lines into messages (MessageBlockGrouper: conversation area above the reply field, timestamps and low-confidence lines dropped), and draws each translation under its message in a click-through overlay. Unchanged windows are skipped by a pixel fingerprint. - Replies: when the user writes in their reading language in a chat whose language is known, the reply is translated after a 700 ms pause and shown in a card under the field; ⌃⌥T (recordable) replaces the draft via select-all + paste with the clipboard restored. Never sends. - Engines: Apple Translation (TranslationSession(installedSource:target:), on-device) for its ~20 languages; for pairs it lacks, such as Macedonian, the selected Open Source model with a few-shot prompt, as the bundled models are base models. Results are cached in memory only. - TranslationLanguagePolicy is conservative (≥12 letters, ≥0.8 confidence, no links or numbers) and recognizes Macedonian by its alphabet, since Natural Language reports it as Bulgarian. Respects Cotabby's own gates (globally on, not paused, app not disabled, Low Power Mode), never reads secure fields, and stores nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
2 of 3 tasks
This branch has not been deployed
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.
Summary
Adds Settings → Translation (off by default). It translates chats in apps the user picks: WhatsApp, Teams, Telegram, Slack, Outlook, Mail and Messages are suggested.
TranslationCoordinatordoes the following:WindowScreenshotService.captureActiveWindow.ScreenTextExtractor.recognitionLanguages.MessageBlockGrouper: only the conversation area above and right of the reply field is read, and timestamps and low-confidence lines are dropped.TranslationOverlayController).SuggestionInserter.replaceFieldText), with the clipboard restored. It never sends. The shortcut tap (TranslationHotkeyTap) exists only while the card is visible.TranslationSession(installedSource:target:), macOS 26+, on-device) handles its roughly 20 languages, at about 22 ms per message once warm on an M-series Mac. For pairs it lacks, such as Macedonian, the selected Open Source model translates with a few-shot prompt (FewShotTranslationPrompt), because the bundled models are base models. Results are cached in memory only (TranslationCache).TranslationLanguagePolicyis deliberately conservative: at least 12 letters, at least 0.8 confidence, and no links or numbers. It recognizes Macedonian by its alphabet, because Natural Language reports Macedonian as Bulgarian.Translation respects Cotabby's own gates (globally on, not paused, app not disabled, Low Power Mode), never reads secure fields, and stores, logs or sends nothing.
Validation
The failure is
AXTextGeometryResolverTests.test_resolveCaretRect_returnsRealGeometry_forNativeTextField, which reads live Accessibility geometry and also fails on unmodifiedmainon this machine.25 new tests cover the language policy (Turkish, Macedonian vs Russian, short text, links, numbers), the cache, few-shot prompt building and output trimming, message grouping on synthetic OCR boxes (wrapped lines, chat list and draft excluded, timestamps dropped), conversation-language tracking, engine routing with fake engines, and preference persistence.
Checked by hand on this Mac: Apple Translation tr→en and en→tr outside the app (375 ms for the first call, 22 ms after).
Draft: not yet exercised end to end in a real chat. Remaining work: tune the grouper on recorded WhatsApp and Teams OCR output, measure Release latency and CPU, and check overlay placement on multiple displays.
Risk / rollout notes
translation) and new UserDefaults keys (cotabbyTranslation*).🤖 Generated with Claude Code