Skip to content

Translate mode: x→y targets and two-way interpreting - #33

Draft
fikrikarim wants to merge 3 commits into
session-updatesfrom
two-way-translation
Draft

Translate mode: x→y targets and two-way interpreting#33
fikrikarim wants to merge 3 commits into
session-updatesfrom
two-way-translation

Conversation

@fikrikarim

Copy link
Copy Markdown
Owner

What's here

Translation stops hardcoding English. "Translate everything I say into Spanish" renders into Spanish with the Spanish voice; "translate between English and Spanish" is a two-way interpreter — the model picks the direction per utterance from the language it hears, and the English voice reads both directions (decided policy: English in the pair anchors the voice).

  • actions.py: the head reports the language(s) involved — one entry is a one-way target, two an interpreting pair (measured 13/14, benchmarks/translatebench.py).
  • modes.py: translate_mode(languages) parameterizes the mode; per-language Kokoro voices for one-way targets (en/es/fr/it/pt/hi — the ones whose G2P works on a stock install), English voice for pairs and unmapped targets.
  • server.py: parameterized TRANSLATE_PROMPT (12/12 across es/fr/ja) + TWO_WAY_PROMPT (5/6; the miss a transcript-only reply the fallback line covers, never a wrong direction).
  • tts.py: Kokoro voices now route through their own language pipeline (lang_code from the voice prefix) — previously all non-English voices were G2P'd as English.
  • pipeline.py: a sentence the voice can't phonemize costs its audio, never the turn.
  • e2e: two new tests (one-way →Spanish; pair mode with real synthesized Spanish speech in both directions). Full suite: 80 passed, 1 skipped.

Draft because: TTS

Kokoro's non-English output is the weak link — we tried it and it doesn't seem great. Before this merges we should explore a TTS with real multilingual support, ideally with automatic language detection so the voice follows the output language per utterance (which would also remove the English-voice-reads-Spanish compromise in pair mode). src/parlor/tts.py is a small interface, so a swap is contained. Known gaps regardless: Japanese/Chinese need the misaki[ja]/misaki[zh] extras; retargeting mid-translate requires exiting first.

🤖 Generated with Claude Code

fikrikarim and others added 3 commits August 2, 2026 23:43
Kokoro voice names carry their language as a prefix; tts.py never
forwarded it, so every non-English voice was G2P'd as American English —
audible as a heavy wrong accent (measured in translatebench). MLX gets
lang_code, ONNX the espeak language map. The default English voice is
byte-identical in behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Head captures targets and pairs 13/14 (languages array; the miss one
repeat of a loose 'interpret between us' phrasing), rendering 12/12
one-way across Spanish/French/Japanese and 5/6 two-way with the
direction right every time it rendered — the miss a transcript-only
reply, the failure shape production's fallback line already covers.
Voice probe writes per-language WAVs for ear checks; es fixtures
synthesize on the Spanish voice.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The decider reports the language(s) involved (one = one-way target,
two = interpreting pair); translate_mode() parameterizes the mode with
its own voice per one-way target and the English voice for pairs —
Kokoro's strongest, and the decided policy when English is one side.
The pair prompt lets the model pick the direction per utterance from
the language it hears. A sentence the voice can't phonemize (Japanese
through the English fallback) now costs its audio, never the turn. The
chip reads 'Translating → Spanish' / 'Interpreting English ↔ Spanish'.
Retargeting mid-translate still requires exiting first — the decider
only sanctions exits while translating.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@fikrikarim
fikrikarim force-pushed the two-way-translation branch from a1c6ef5 to 2ec4795 Compare August 2, 2026 16: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