Most translation features work the same way. The user types text, your app sends it to a translation API, and the API sends a translation back. That works, but every request adds cost and latency, and your users' text leaves their device.
Chrome now ships two built-in AI APIs that change this: the Translator API and the Language Detector API . Chrome downloads small, specialized models on demand and runs them on the user's device. You don't host a model, run an inference server, or pay per request. You call a JavaScript API.
In this tutorial, you'll build a translator in Next.js that:
Detects the language of the text a user types.
Translates it into a language they choose.
Streams the translation into the page as Chrome produces it.
Shows language-pack download progress, and lets the user cancel.
Copies the translation, reads it aloud, and swaps the two languages.
Handles browsers that don't support the APIs.
Table of Contents
Prerequisites
Internationalization vs AI Translation
How Chrome's…