Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The create() static method of the Translator interface creates a new Translator instance that can be used to translate text.
Note: The create() method requires transient activation, that is, it must be invoked in response to a user action such as a mouse click or button press.
Translator.create(options)
optionsAn object specifying configuration options for the Translator. Possible values include:
sourceLanguageA string specifying the expected language of the input text to be translated, which should be a valid BCP 47 language tag (as specified in RFC 5646).
targetLanguageA string specifying the language that the input text will be translated into, which should be valid BCP 47 language tag.
monitor OptionalA callback function with a CreateMonitor argument that enables monitoring download progress of the AI model.
signal OptionalAn AbortSignal object instance, which allows the create() operation to be aborted via the associated AbortController.
A Promise that fulfills with a Translator object instance.
InvalidStateError DOMException
Thrown if the page's Document is not yet active.
NetworkError DOMException
Thrown if:
NotAllowedError DOMException
Thrown if:
translator Permissions-Policy.create() method wasn't called via transient activation.NotSupportedError DOMException
Thrown if:
sourceLanguage or targetLanguage are invalid, or not supported. This is the case if the specified sourceLanguage and targetLanguage are the same.sourceLanguage and targetLanguage is not available.OperationError DOMException
General-purpose exception thrown if Translator creation failed for any other reason.
Translator creationconst translator = await Translator.create({
sourceLanguage: "en",
targetLanguage: "ja",
});
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
create_static |
138Availability may be subject to geographical restrictions. |
No | No | 122Availability may be subject to geographical restrictions. |
No | No | No | No | No | No | No | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Translator/create_static