The translate attribute marks whether an element's text and translatable attributes should change during localization. A no value is appropriate for a fixed identifier, not for the instructions around it.
HTML translate attribute: protect identifiers while localizing the surrounding text
Use the contract
A dispatch dashboard gives human instructions next to a stable service code. The sentence must be localized; the code must remain the same token that appears in logs and support calls. Wrap only that token. Inherited translation mode means a broad no on the main container would also protect ordinary help text, labels, and headings from translation. The language attribute remains a separate concern: it identifies the language of content for pronunciation and processing. A protected code does not give the rest of the document a language, and a language tag does not prevent an identifier from being translated by a localization workflow.
<main>
<h1>Dispatch review</h1>
<p>Quote service code <code translate="no">DS-47Q</code> when reporting a failed transfer.</p>
<p>Describe the failure in the language used by the support team.</p>
</main>Behavior and cost
The attribute adds no runtime bundle. Its cost appears in the translation pipeline: translators need clear context for protected tokens and a review of visible strings after localization. Automated browser translation may not behave exactly like a managed translation system, so test the actual workflow. If a token has several display forms, decide centrally which form is stable rather than scattering no-translate spans through generated copy. Check that accessible names and image alternatives still read naturally in each language.
Common Mistakes
- Do not set translate=no on a whole article to protect one code.
- Do not use the attribute as a substitute for lang or dir.
- Do not assume a translation tool will preserve every token without review.
