v148 · AI · JavaScript

Local-First Workflow

Three on-device translation app flows: a chat message translator, a multilingual form that translates labels for the user's locale, and a content review assistant that translates then classifies user-generated content — all without an API key or server round-trip.

On-device No API key Works offline
⚠ Translator API not available — demos use a phonetic/word-swap simulation. Enable via chrome://flags/#translation-api or join the origin trial.
From: To:
Message
Translation
Press "Translate" to convert the message…
UI language:
Full name
Email address
Message
Submit
Select a language above to translate form labels.
Submission language:
User-generated content
Translation (→ English)
Press "Translate & review" to process…
Automated classification
// Local-first translation pattern const translator = await Translator.create({ sourceLanguage: 'fr', targetLanguage: 'en' }); // Translate once — reuse the same Translator instance const translated = await translator.translate(userMessage); // For forms: translate multiple strings in parallel const [nameLabel, emailLabel, msgLabel] = await Promise.all([ translator.translate('Full name'), translator.translate('Email address'), translator.translate('Message'), ]);

see also

references

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗