Translator and Language Detector APIs - Web APIs | MDN Skip to main content Skip to search MDN HTML HTML: Markup language HTML reference Elements Global attributes Attributes See all… HTML guides Responsive images HTML cheatsheet Date & time formats See all… Markup languages SVG MathML XML CSS CSS: Styling language CSS reference Properties Selectors At-rules Values See all… CSS guides Box model Animations Flexbox Colors See all… Layout cookbook Column layouts Centering an element Card component See all… JavaScriptJS JavaScript: Scripting language JS reference Standard built-in objects Expressions & operators Statements & declarations Functions See all… JS guides Control flow & error handing Loops and iteration Working with objects Using classes See all… Web APIs Web APIs: Programming interfaces Web API reference File system API Fetch API Geolocation API HTML DOM API Push API Service worker API See all… Web API guides Using the Web animation API Using the Fetch API Working with the History API Using the Web speech API Using web workers All All web technology Technologies Accessibility HTTP URI Web extensions WebAssembly WebDriver See all… Topics Media Performance Privacy Security Progressive web apps Learn Learn web development Frontend developer course Getting started modules Core modules MDN Curriculum Check out the video course from Scrimba, our partner Learn HTML Structuring content with HTML module Learn CSS CSS styling basics module CSS layout module Learn JavaScript Dynamic scripting with JavaScript module Tools Discover our tools Playground HTTP Observatory Border-image generator Border-radius generator Box-shadow generator Color format converter Color mixer Shape generator About Get to know MDN better About MDN Advertise with us Community MDN on GitHub Blog Toggle sidebar Web Web APIs Translator and Language Detector APIs Theme OS default Light Dark English (US) Remember language Learn more Deutsch English (US) Translator and Language Detector APIs Limited availability This feature is not Baseline because it does not work in some of the most widely-used browsers. Want more browser support for this feature? Tell us why. Learn more See full compatibility 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 Translator and Language Detector APIs provide functionality to detect the language that text is written in, and to translate text into different languages, via a browser's own internal AI model (which may differ between browsers). In this article Concepts and usage Interfaces HTTP headers Security considerations Examples Specifications Browser compatibility See also Concepts and usage Translating a body of text is a common task on today's web. Typical use cases include: On-the-fly translation of an article that isn't available in your language. Translating a user's support requests into a language the support agent understands. Facilitating chats between users that don't speak each other's languages. Detecting the language of a body of test is an important precursor for successful automated translation, but has other uses beyond direct translation. For example, it allows automatic UI configuration based on user text entry, ranging from updating UI and error strings, to automatically loading appropriate dictionaries for spell checking or curse word detection. AI is well-suited to facilitating language detection and translation. The Translator and Language Detector APIs provide asynchronous (Promise-based) mechanisms for a website to detect languages and translate text via the browser's own internal AI model. This is useful and efficient because the browser handles the service, rather than the developer having to rely on the user downloading AI models, or host or pay for a cloud-based translation service. Language detection is done via the LanguageDetector interface. A LanguageDetector object instance is created using the LanguageDetector.create() static method, then the detect() instance method is passed the text string to detect the language for. Translation is done via the Translator interface. A Translator object instance is created using the Translator.create() static method, then the translate() instance method is passed the text string to translate. You can cancel a pending create(), detect(), or translate() operation using an AbortController. After a LanguageDetector or Translator instance has been created, you can release its assigned resources and stop any further activity by calling its LanguageDetector.destroy()/Translator.destroy() method. You are encouraged to do this after you've finished with the object as it can consume a lot of resources. See Using the Translator and Language Detector APIs for a walkthrough of how to use the APIs. Interfaces LanguageDetector Contains all the language detection functionality, including checking AI model availability, creating a new LanguageDetector instance, using it to detect a language, and more. Translator Contains all the translation functionality, including checking AI model availability, creating a new Translator instance, using it to create a translation, and more. HTTP headers Permissions-Policy; the language-detector directive Controls access to the language detection functionality. Where a policy specifically disallows its use, the LanguageDetector.availability() static method will return unavailable, and any attempts to call other LanguageDetector methods will fail with a NotAllowedError DOMException. Permissions-Policy; the translator directive Controls access to the translation functionality. Where a policy specifically disallows its use, the Translator.availability() static method will return unavailable, and any attempts to call other Translator methods will fail with a NotAllowedError DOMException. Security considerations Creation of LanguageDetector and Translator objects requires that the user has recently interacted with the page (transient user activation is required). Access to the API is also controlled via language-detector and translator Permissions-Policy directives. Examples For a full example, see Using the Translator and Language Detector APIs. Specifications Specification Unknown specification Browser compatibility Enable JavaScript to view this browser compatibility table. See also Language detection with built-in AI on developer.chrome.com (2025) Translation with built-in AI on developer.chrome.com (2025) Help improve MDN Was this page helpful to you? Yes No Learn how to contribute This page was last modified on May 18, 2026 by MDN contributors. View this page on GitHub • Report a problem with this content Filter sidebar Clear filter input Translator and Language Detector APIs Guides Using the Translator and Language Detector APIs Interfaces CreateMonitor LanguageDetector Translator MDN Your blueprint for a better internet. MDN About Blog Mozilla careers Advertise with us MDN Plus Product help Contribute MDN Community Community resources Writing guidelines MDN Discord MDN on GitHub Developers Web technologies Learn web development Guides Tutorials Glossary Hacks blog Mozilla Website Privacy Notice Telemetry Settings Legal Community Participation Guidelines Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.