In HTML, the translate
attribute is used to identify whether the text content of an element can be translated to another language or not after web page localization.
<div translate="yes">Hello</div>
The translate
attribute takes two values:
yes
: This tells that the content of the element can be translated.
no
: This tells that the content of the element should not be translated.
<html><head></head><body><footer><small>© 2022 <span translate="no">Educative.io</span></small></footer></body></html>
Lines 5-7: We create a footer
section and add a span
element that contains the name of the brand inside it. Because there is no need to translate the name of the brand or product while localizing a website, we add the translate="no"
tag to the span
element. This makes sure that the content of the span
element is not translated when the web page is translated to other languages using the translation tool.
Note: The translate attribute is newly added in
HTML5
.