HTML translate Global Attribute
Description
The translate
global attribute in HTML is used to specify whether the content of an element should be translated when the page is localized. It is an enumerated attribute that can have the following values:
empty string
oryes
: The element will be translated when the page is localized.no
: The element will not be translated when the page is localized.
The translate
attribute can be used with any HTML element. It is especially useful for marking content that should not be translated, such as:
- User-generated content, such as comments or forum posts
- Trademark names or slogans
- Technical terms
- Code snippets
The translate
attribute is not supported by all browsers, but it is respected by automatic translation systems such as Google Translate, and may also be respected by tools used by human translators. As such, it's important that web authors use this attribute to mark content that should not be translated.
Here is an example of how to use the translate
attribute:
<p translate="no">This text will not be translated.</p>
If a user is viewing the page in a different language, the text in the <p>
element will remain in the original language.
The translate
attribute is a valuable tool for creating multilingual websites and applications. It allows web authors to ensure that their content is translated accurately, and that important information is not lost in translation.
Syntax
<element translate="yes | no">
Values
- yesTells the browser that the content in the element should be translated.
- noTells the browser that the content in the item cannot be translated.
Example
<p translate="no">Content of the element should not translated.</p>
<p translate="yes">Content of the element should be translated.</p>
Browser Support
The following table will show you the current browser support for the HTML translate
Global Attribute.
Desktop | |||||
x | x | x | x | x |
Tablets / Mobile | |||||
x | x | x | x | x | x |
Last updated by CSSPortal on: 14th October 2023