pub enum Translate {
Yes,
No,
}Expand description
The translate attribute values.
§Purpose
Indicates whether an element’s text content and attribute values should be translated when the page is localized, useful for multilingual applications.
§Usage Context
- Used with: All HTML elements (global attribute)
- Common use: Marking technical terms, brand names, or code that shouldn’t be translated
- Default:
yes(content is translatable)
§Valid Values
Yes: Content should be translated when localizing the pageNo: Content should not be translated (e.g., brand names, code)
§Example
use ironhtml_attributes::{AttributeValue, Translate};
let trans = Translate::No;
assert_eq!(trans.to_attr_value(), "no");<p>Welcome to <span translate="no">GitHub</span>!</p>
<code translate="no">const x = 42;</code>
<p translate="yes">This text can be translated</p>§WHATWG Specification
Variants§
Yes
Element’s text and attributes should be translated when the page is localized.
No
Element’s text and attributes should not be translated. Use for brand names, code samples, or technical terms.
Trait Implementations§
Source§impl AttributeValue for Translate
impl AttributeValue for Translate
Source§fn to_attr_value(&self) -> Cow<'static, str>
fn to_attr_value(&self) -> Cow<'static, str>
Convert to the attribute value string.
impl Copy for Translate
impl Eq for Translate
impl StructuralPartialEq for Translate
Auto Trait Implementations§
impl Freeze for Translate
impl RefUnwindSafe for Translate
impl Send for Translate
impl Sync for Translate
impl Unpin for Translate
impl UnwindSafe for Translate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more