{{HTMLSidebar("Global_attributes")}}{{SeeCompatTable}}
The translate global attribute is an enumerated attribute that is used to specify whether an element's attribute values and the values of its Text
node children are to be translated when the page is localized, or whether to leave them unchanged. It can have the following values:
- empty string and "yes", which indicates that the element will be translated.
- "no", which indicates that the element will not be translated.
In addition, there is a third state, the inherit state, which is the missing value default (and the invalid value default ).
When an element is in the translate-enabled state, the element's translatable attributes and the values of its Text
node children are to be translated when the page is localized.
When an element is in the no-translate state, the element's attribute values and the values of its Text
node children are to be left as-is when the page is localized, e.g. because the element contains a person's name or a the name of a computer program.
The translate
IDL attribute must, on getting, return true if the element's translation mode is translate-enabled, and false otherwise. On setting, it must set the content attribute's value to "yes
" if the new value is true, and set the content attribute's value to "no
" otherwise.
Specifications
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG', "dom.html#attr-translate", "translate")}} | {{Spec2('HTML WHATWG')}} | No change from latest snapshot, {{SpecName('HTML5.1')}} |
{{SpecName('HTML5.1', "dom.html#the-translate-attribute", "translate")}} | {{Spec2('HTML5.1')}} | Snapshot of {{SpecName('HTML WHATWG')}}, initial definition |
Browser compatibility
{{ CompatibilityTable() }}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | {{ CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | {{ CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} | {{CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} |
See also
- All global attributes.