Codectionary / Developer documentation / HTML

Controlling Translation with translate

The global translate attribute marks whether text and certain attribute values should be translated during localisation. translate="no" is useful for names, commands and other text that must stay exact. It is a hint for localisation tools, not a language selector or a command that translates the page; use lang to declare the actual content language.

Syntax

<p>Open <span translate="no">Codectionary</span> to learn.</p>
<code translate="no">npm install</code>

Examples

Controlling Translation with translate: working example

Save as an HTML file and open it in a browser. Expected result: The text displays normally, and the output reports Brand translation enabled: false. The page itself is not translated.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>HTML example</title>
</head>
<body>
<p>Read the guide on <span id="brand" translate="no">Codectionary</span>.</p>
<p>Type <code translate="no">npm install</code> in your terminal.</p>
<output id="hint"></output>
<script>
const brand = document.querySelector("#brand");
document.querySelector("#hint").textContent = `Brand translation enabled: ${brand.translate}`;
</script>
</body>
</html>
  1. translate="no" tells a localisation process to leave Codectionary and the command unchanged. Descendants inherit the no-translate mode unless they override it.
  2. The brand element’s translate property reads false, confirming the declared mode in this browser. That does not prove that every translation service honours the hint.
  3. The document’s lang="en" declares its current language. The translate attribute has a different purpose: deciding which text should stay unchanged when localised.

Best practices

  • Use translate="no" only where exact wording must remain unchanged.
  • Keep lang accurate for the surrounding document and any passages in another language.
  • Review translated pages; an attribute cannot guarantee third-party translation behaviour.

Browser compatibility

Support applies to the named feature, not every attribute or behaviour in this article. Versions refer to browsers, not operating systems.

translate

Desktop

Chrome
Supported
From 19
Firefox
Supported
From 111
Safari
Supported
From 6
Edge
Supported
From 79
Opera
Supported
From 15

Mobile

Safari on iOS
Supported
From 6
Chrome for Android
Supported
From 25
Firefox for Android
Supported
From 111
Samsung Internet
Supported
From 1.5

MDN BCD record for this feature · MDN reference

Support history and limitations

Chrome

  • From 19

Firefox

  • From 111

Safari

  • From 6

Edge

  • From 79

Opera

  • From 15

Safari on iOS

  • From 6

Chrome for Android

  • From 25

Firefox for Android

  • From 111

Samsung Internet

  • From 1.5
HTMLElement.translate

Desktop

Chrome
Supported
From 19
Firefox
Supported
From 111
Safari
Supported
From 6
Edge
Supported
From 79
Opera
Supported
From 15

Mobile

Safari on iOS
Supported
From 6
Chrome for Android
Supported
From 25
Firefox for Android
Supported
From 111
Samsung Internet
Supported
From 1.5

MDN BCD record for this feature · MDN reference

Support history and limitations

Chrome

  • From 19

Firefox

  • From 111

Safari

  • From 6

Edge

  • From 79

Opera

  • From 15

Safari on iOS

  • From 6

Chrome for Android

  • From 25

Firefox for Android

  • From 111

Samsung Internet

  • From 1.5

MDN BCD 8.1.5 · Dataset built 2026-10-08 · Mapping reviewed 2026-10-21. These dates are not individual browser-test or claim-verification dates. Unknown means the data does not establish support.

HTML Living Standard

Specifications & further reading