π Translation
Sentence-level translation across 16+ languages. Offline-first via bundled dictionary; cloud upgrade via Gemini Flash for richer phrasing when online.
---
π Two-Path Translation Engine
| Path | Engine | When | Quality | Latency | Offline |
|---|---|---|---|---|---|
| Offline dictionary | Bundled offlineDictionary.ts (4000+ word pairs Γ 14 locales) | Always tried first; sole engine when offline | Word-level: good. Phrase-level: limited. | <10ms | β
|
| Cloud (Gemini 2.5 Flash) | /api/v1/translate β Gemini Flash | When online + dictionary miss / sentence-level | Excellent β preserves tense, idiom, register | ~700ms | β |
!Global Dashboard β Translation Support
The Prism AAC keyboard's "translate this sentence" feature uses both: dictionary fallback ensures the device always responds, cloud upgrade kicks in when online for better phrasing.
---
π Language Coverage
Bundled offline:
en Β· es Β· fr Β· pt Β· ja Β· zh Β· de Β· ko Β· ar Β· ro Β· uk Β· ru Β· it Β· nl
Cloud-only (uses Gemini's 100+ language coverage when online):
hi Β· bn Β· tr Β· pl Β· vi Β· th Β· ...
---
π©Ί Why Offline-First Matters
* AAC users in school / clinic / remote settings can't depend on Wi-Fi.
* Patient communication during home visits β clinician's offline dictionary + premium TTS keeps the conversation going.
* School deployments β bandwidth is throttled or filtered; translation must still work.
---
ποΈ Architecture
``
POST /api/v1/translate { text, sourceLang, targetLang, mode? }
β { translated, source, model }
mode: 'word' | 'sentence' (default: auto)
`
Client-side path (in services/translateService.ts):
(5s timeout matching /text/correct`).---
π Inter-Module Integration
* Prism AAC keyboard β "translate" toggle pre-translates outgoing speech.
* AAC chat β response auto-translated to the user's locale before display.
* Mail β incoming non-locale messages get a one-tap translate-inline.
* Patient portal β UI auto-translates per the patient's preferred language (cookie + browser detect).
---
π³ Plans
Available on every tier β translation is an accessibility primitive, not a billing surface. Cloud-translation usage is rate-limited on free tier (200 calls/user/day, same as autocorrect) to control cost.