files/en-us/web/api/translator/index.md
{{APIRef("Translator and Language Detector APIs")}}{{SeeCompatTable}}{{securecontext_header}}
The Translator interface of the {{domxref("Translator and Language Detector APIs", "Translator and Language Detector APIs", "", "nocode")}} contains all the associated translation functionality, including checking AI model availability, creating a new Translator instance, using it to create a translation, and more.
{{InheritanceDiagram}}
Translator configuration.Translator instance from which to generate translations.Translator instance it is called on and stops any further activity on it.See Using the Translator and Language Detector APIs for a complete example.
Translator instanceconst translator = await Translator.create({
sourceLanguage: "en",
targetLanguage: "ja",
});
const translation = await translator.translate(myTextString);
console.log(translation);
const stream = translator.translateStreaming(myTextString);
let translation = "";
for await (const chunk of stream) {
translation += chunk;
}
console.log("Stream complete");
console.log(translation);
{{Specifications}}
{{Compat}}