Skip to content

Make the "English" Language setting actually translate - #57

Merged
initcore0 merged 1 commit into
mainfrom
fix/whisper-translate-to-english
Jun 24, 2026
Merged

Make the "English" Language setting actually translate#57
initcore0 merged 1 commit into
mainfrom
fix/whisper-translate-to-english

Conversation

@initcore0

Copy link
Copy Markdown
Owner

Diagnosed while chasing the «переведи на английский» report. After #56 stopped the voice-command from leaking into the LLM, dictating Russian with the Language set to English produced Russian output — because the "English — Whisper translate to English" setting never actually translated.

Root cause (verified on real audio)

WhisperEngine passed -l en (which tells whisper the source is English) and never the --translate flag. Translation only ever "worked" by accident — the spoken command leaked into the LLM, which executed it. With that leak fixed, there was no whisper-native translation path at all.

Proven with the bundled whisper-cli on synthesized Russian speech:

-l auto              -> "Всем привет, как ваша дела сегодня!"          (Russian)
-l auto --translate  -> "Hello everyone, how are you doing today?"     (English)

Changes

  • WhisperTask.resolve(languageSetting:) (OpenWhispCore, pure): "en"(language: auto, translate: true); any other value → (that language, translate: false). --translate always targets English and needs the source auto-detected, so "en" must not be sent as the source language.
  • WhisperEngine: CLI path appends --translate; server path sends translate=true + language=auto. Both go through the shared resolver.
  • Tests: +4 WhisperTaskTests. 177 → 181.

Gives translation without the LLM (whisper-native) — matching the chosen model: translate via the persistent Language setting, not a voice command.

swift test 181/181 · ./build.sh clean.

🤖 Generated with Claude Code

The Language picker's "English — Whisper translate to English" never translated:
the engine passed `-l en` (telling whisper the SOURCE is English) and never the
`--translate` flag. Translation only "worked" before because the spoken command
("переведи на английский") leaked into the LLM, which executed it — and the prior
PR (#56) correctly stopped that leak, exposing that there was no real translation
path without the LLM.

Verified on synthesized Russian audio with the bundled whisper-cli:
  -l auto             -> "Всем привет, как ваша дела сегодня!"  (Russian)
  -l auto --translate -> "Hello everyone, how are you doing today?"  (English)

- New WhisperTask.resolve(languageSetting:) (OpenWhispCore, pure): maps "en" ->
  (language: auto, translate: true); everything else -> (that language, no
  translate). whisper's --translate always targets English and needs the source
  auto-detected, so "en" must NOT be sent as the source language.
- WhisperEngine CLI path now appends --translate; server path sends translate=true
  + language=auto. Both via the shared resolver.
- Tests: +4 WhisperTaskTests. 177 -> 181.

This gives translation WITHOUT the LLM (whisper-native), per the chosen behavior:
translate via the persistent Language setting, not via a voice command.

swift test 181/181; ./build.sh clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@initcore0
initcore0 merged commit 2898bd5 into main Jun 24, 2026
3 checks passed
@initcore0
initcore0 deleted the fix/whisper-translate-to-english branch June 24, 2026 01:45
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