hex/ios/HEXKeyboard
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ryan Vogel 2a023f9122
iOS: translation says when it pastes as spoken, retries, and never turns itself off (#2176)
* iOS: Translate what I say says when it pastes as spoken, and nothing turns it off by itself

TestFlight build 56 testers saw translation stop "after a while" with no sign of why
(a Chinese tester: "翻译功能突然没办法用了,一开始可以"; another lost the Hex key menu's
Paste in Hindi / Paste in English pair and had to re-enable translation in Settings).
Every failure path in DictationTranslator returned nil, so the transcript went in as
spoken with nothing said: no language pack (never downloaded, removed in iOS Settings,
or still downloading), a pair Apple can't translate, a TranslationSession whose
translate() threw (internalError, as when Apple's Translate app is missing), and
build 56's "Paste in <source>" choice, which left pastesTranslation false while
Settings' switch still read on.

What changed:
- DictationTranslator.translate returns a TranslationOutcome (skipped, translated, or
  failed with a TranslationFailure: notDownloaded, unsupported, failed, plus Apple's
  error code, never the text). A failed translate() is tried once more in a new
  TranslationSession; a missing pack or unsupported pair isn't retried. Sessions are
  never kept. Apple's framework sits behind TranslationEngine so tests stand in for it.
- The failure rides DictationPipeline.Stages, KeyboardSnapshot (optional, old snapshots
  still decode) and in-keyboard dictation's finished phase. When the keyboard inserts
  such a dictation, both keyboards show "Couldn't translate, pasted as spoken" over the
  fix ("Download Chinese in Settings") for 8 s: the full keyboard's strip in the Full
  Access hint's shape with Open Hex, the dictation bar as a tappable two-line note.
  Both open hex-dictation://keyboard/translation (KeyboardLaunchRequest.translationSettings),
  which opens Settings › Dictation. VoiceOver announces it.
- Settings keeps the last failure (experiments.translateDictation.lastFailure) until a
  dictation translates, checks status for the pair that failed, refreshes it on
  foreground (packs can be removed meanwhile), and its Download button invalidates a
  repeated TranslationSession.Configuration, which translationTask otherwise never
  runs again after a cancelled download.
- One switch: removed the pastesTranslation setting, Settings' "Paste in English"
  toggle and KeyboardViewModel.pastesTranslation/isTranslating's paste half. A stored
  pastesTranslation=false from build 56 reads as off in Settings and the keyboard alike,
  and the next switch removes it, so the two never disagree again.
- zh-Hans strings for the new copy.

Verified: xcodebuild test on an iPhone 17 simulator (iOS 27.2), 515 tests, 0 failures,
new cases in HexKeyGestureTests (missing pack zh->en and en->zh, unsupported pair,
retry in a new session, 30 dictations with intermittent failures never sticking,
build 56's stored "as spoken", the pipeline both ways, the strip's note) and
KeyboardBridgeTests (snapshot round trip and old JSON, the launch URL). Screenshots of
both keyboards' notes in English and Chinese. The simulator reports Apple translation
unsupported on the device, so real downloads and sessions need an iPhone.

* iOS: Hinglish dictations going into another language are translated from Devanagari

With Hinglish on (#2119), DictationPipeline romanized Hindi into Latin letters before
every step, translation included, so Translate what I say handed Apple's Hindi
translator Latin-letter Hindi it can't read: the result came back garbled or unchanged.
Now a Hindi dictation that may go into another language keeps Apple Speech's
Devanagari through the steps and translation; if it goes in as spoken (off, failed, or
skipped) it is romanized then, so it is still Hinglish. Stages.heard stays in Latin
letters for learning, as before; Hindi into Hindi is unchanged.

Verified: xcodebuild test on an iPhone 17 simulator (iOS 27.2), all tests passing,
with HinglishRomanizerTests.testHinglishTranslatesFromDevanagari (the translator gets
the Devanagari; a missing pack pastes "Mera phone charge nahi ho raha." and says
"Download Hindi in Settings").
2026-11-21 06:33:37 -05:00
..
CleanupTagger iOS: clean up what I say with an on-device tagger (experiment) (#2023) 2026-11-20 01:29:41 +00:00
TypingModel iOS: German autocorrect capitalises common nouns (haus, auto, zeit) (#2169) 2026-11-21 05:30:03 -05:00
ContainingAppOpener.swift Open Hex from the iPhone keyboard and show live keyboard setup (#599) 2026-10-31 09:56:02 -07:00
HEXKeyboard.entitlements Set up Hex Mobile internal TestFlight releases (#1997) 2026-11-19 11:48:49 -05:00
Info.plist iOS: plain permission prompts and no pre-prompt Allow button, for App Review (#2058) 2026-11-20 16:13:36 +00:00
KeyboardLocalDictation.swift iOS: translation says when it pastes as spoken, retries, and never turns itself off (#2176) 2026-11-21 06:33:37 -05:00
KeyboardViewController.swift iOS: translation says when it pastes as spoken, retries, and never turns itself off (#2176) 2026-11-21 06:33:37 -05:00
PrivacyInfo.xcprivacy iOS: version 1.0, iPhone only, privacy manifests (#2052) 2026-11-20 15:54:01 +00:00