Ai translate

AI Translate — Translation Service

  • *rea:*Intelligence
  • *ath:*services/ai/translate
  • *ind:*Translation as a service (text + document + glossary), ptBR ↔ enUS priority
  • *tatus:*v0.0.1 — sector bootstrapping (20260509)

Role in the stack

translate centralizes a capability that was previously scattered: every Koder UI is bilingual by policy (policies/language.kmd — chat ptBR, products enUS), and every product was calling gateway/ adhoc 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, brandaware 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 *istinct 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 (ptBR ↔ enUS priority, +eszhja secondary)
  • Async document translation with format preservation (md, html, json, po, xliff)
  • Pertenant glossary + Koderofficial base (versioned in repo)
  • NMTfirst routing (NLLB200 default), LLM fallback for lowconfidence/longform
  • Confidence scoring + human feedback loop (corrections feed cache + prompt signal)
  • CLI ktrans for i18n bundle sync (enUS baseline → ptBReszh/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) Ondemand strings, missingkey fill
Documentation pipeline Bilingual Stack docs
services/ai/kode and product chats Userfacing translatethis commands
services/ai/dataset Bilingual training data prep

RFC and bootstrap

  • RFC: translate-RFC-001-foundations.kmd — *ccepted*20260509
  • Bootstrap ticket: services/ai/backlog/done/131-translate-bootstrap.md
  • Implementation tickets: services/ai/translate/backlog/pending/{001..005}

Selfhostedfirst 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

Source: ../home/koder/dev/koder/meta/docs/stack/modules/ai-translate.md