AI Translate — Translation Service

  • Area: Intelligence
  • Path: services/ai/translate
  • Kind: Translation as a service (text + document + glossary), pt-BR ↔ en-US priority
  • Status: v0.1.0 — foundation shipped (2026-05-24); Provider interface + Stub, glossary resolution (text + document paths), feedback endpoint, Go SDK

Role in the stack

translate centralizes a capability that was previously scattered: every Koder UI is bilingual by policy (policies/language.kmd — chat pt-BR, products en-US), and every product was calling gateway/ ad-hoc with full LLM cost per translation, no caching, no glossary enforcement. This sector consolidates the capability so every consumer calls one endpoint and gets the right answer at the right cost — cached repeats, brand-aware glossary, NMT-first routing with LLM fallback for hard cases.

It is the Koder analog of DeepL and Google Translate API, scoped to the language pairs that matter for Koder products and explicitly distinct from signs/ (sign language is a separate domain, not translation between natural languages).

Boundary vs neighbors

  • services/ai/signs is sign language — separate domain, not natural-language translation.
  • services/ai/cache provides the segment-level translation cache backend.
  • services/ai/prompt owns translation prompt templates.
  • services/ai/gateway is the LLM-fallback path; services/ai/runtime serves NMT models.
  • i18n pipeline (koder_kit, koder_web_kit, engines/sdk/go/l10n) is the primary product-facing consumer.

Features (v1 target)

  • Synchronous text translation (pt-BR ↔ en-US priority, +eszhja secondary)
  • Async document translation with format preservation (md, html, json, po, xliff)
  • Per-tenant glossary + Koder-official base (versioned in repo)
  • NMT-first routing (NLLB-200 default), LLM fallback for low-confidence/long-form
  • Confidence scoring + human feedback loop (corrections feed cache + prompt signal)
  • CLI ktrans for i18n bundle sync (en-US baseline → pt-BReszh/ja)
  • ICU placeholder integrity validation
  • Per-tenant rate limit; resumable document jobs

Primary couplings

Producer Relationship
services/ai/gateway LLM fallback for hard cases
services/ai/cache Translation cache (segment-level)
services/ai/prompt Translation prompt templates
services/ai/runtime NMT model serving (NLLB-200)
Consumer Relationship
All Koder UIs (koder_kit + koder_web_kit i18n) On-demand strings, missing-key fill
Documentation pipeline Bilingual Stack docs
services/ai/kode and product chats User-facing translate-this commands
services/ai/dataset Bilingual training data prep

RFC and bootstrap

  • RFC: translate-RFC-001-foundations.kmdaccepted 2026-05-09
  • Bootstrap ticket: services/ai/backlog/done/131-translate-bootstrap.md
  • Implementation tickets: services/ai/translate/backlog/pending/{001..005}

Self-hosted-first analysis (5 gates)

Gate Status Notes
G1 Feature parity pending NLLB-200 covers most pairs; LLM fallback fills the rest
G2 Performance pending Target p95 < 200ms cache, < 1.5s NMT, < 4s LLM
G3 Stability pending Pre-MVP
G4 Capability pending Real-time speech translation deferred to synth+voice combination
G5 Critical-path readiness pending Unblocks consistent + cheap i18n across stack