translate

The translate attribute in HTML determines if the content of an element should be translated when the page is viewed in different languages. It accepts values of "yes" or "no."

translate Attribute

The translate attribute specifies if an element's text should be translated during localization:

  • "" or yes: The text will be translated.
  • no: The text will remain untranslated.

Syntax

index.html
<element translate="yes | no">

Example

index.html
<p translate="no">Don't translate this!</p>
<p>This can be translated to any language.</p>
Instead, apply class="notranslate" to prevent translation.

Applicable to

The translate attribute is a global attributes, meaning it can be applied to any HTML element.

ElementsAttribute
All HTML elementstranslate

Values

  • yes: Specifies that the content should be translated.
  • no: Specifies that the content should not be translated.

See also

  • All global attributes
  • The HTMLElement.translate property corresponds to this attribute.
  • HTML lang attribute

Conclusion

The translate attribute in HTML controls whether an element’s text should be translated during localization. It helps ensure content is appropriately adapted for different languages. However, for certain situations, you can use the class="notranslate" method for finer control over translation behavior.