Skip to content

Add a "Translate" toolbar button to the dictionary search sheet - #65

Open
megabulk wants to merge 1 commit into
classicsc:mainfrom
megabulk:add-translate-button
Open

megabulk wants to merge 1 commit into
classicsc:mainfrom
megabulk:add-translate-button

Conversation

@megabulk

Copy link
Copy Markdown

What this does

Adds a "Translate" button to the dictionary search toolbar (next to Furigana) that sends the current context sentence directly to iOS's built-in Translate sheet, in one tap — no need to switch to Edit mode, manually select all the text, and choose Translate from the contextual menu.

This follows up on the request in #61.

Why this approach

Rather than introducing a new machine-translation engine, this reuses Apple's own system Translate sheet — the same one already reachable today via Edit mode → select text → Translate from the contextual menu. It's just skipping the manual-selection step. No new translation dependency, no new UI surface to maintain.

Behavior notes

  • If the user is mid-edit in the context box, it translates the in-progress edited text rather than the original OCR'd text.
  • iPad/iPhone only for now. I looked into Mac (both Mac Catalyst and "Designed for iPad" mode) and ran into real platform limitations — .translationPresentation is unavailable at compile time under Mac Catalyst, and unreliable under "Designed for iPad." Rather than ship something half-working, the button is hidden on Mac entirely. Happy to revisit Mac support in a follow-up if there's interest.

Testing

Tested on iPad Simulator and a physical iPad, with real dictionary content (Jitendex + SudachiDict tokenizer) imported, across both the normal display and in-progress-edit cases.

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