HTML - translate Attribute



HTML translate attribute is used to specify whether the content of an element should be translated when the page is localized.

This attribute is essential for making sure that web information is simple to understand and adapt to many linguistic and cultural contexts.

Syntax

<element translate = "no/yes" >

Applies On

Since translate is a global attribute in HTML, all the tags in HTML support translate attribute.

Example of HTML translate attribute

Below examples will illustrate the HTML height attribute, where and how we should use this attribute!

Preventing autotranslation using translate Attribute

In the following example, we are creating an HTML document and using the translate attribute to ask translation tools not to translate the company’s brand name in the footer section.

<!DOCTYPE html>
<html>

<body>
   <footer>
      <small> © 2020 
         <span translate="no">
            tutorialspoint
         </span>
      </small>
   </footer>
</body>

</html>

Allow translation of a paragraph Element

In this example we are setting translate attribute value as yes. So that the paragraph can be translated by external source.

<!DOCTYPE html>
<html>

<body>
   <h1>tutorialspoint</h1>
   <h2>translate attribute</h2>
   <p translate="yes">
      This can be translated
   </p>
</body>

</html>

Supported Browsers

Attribute Chrome Edge Firefox Safari Opera
translate Not Supported Not Supported Not Supported Not Supported Not Supported
html_attributes_reference.htm
Advertisements