Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

HTML5 To Get Translate Attribute, Bring World Closer Together

DZone's Guide to

HTML5 To Get Translate Attribute, Bring World Closer Together

· Web Dev Zone
Free Resource

Learn how to build modern digital experience apps with Crafter CMS. Download this eBook now. Brought to you in partnership with Crafter Software

The W3C Open Web Platform Weekly Summary announced that HTML5 will receive a translate attribute with the goal of specifying pieces of text that should or should not be translated by machine translators.  This announcement continues the movement of improving semantics in HTML5, and was originally suggested on the W3C Bug/Issue Tracking Service:

Since this is becoming a widely-felt problem, it seems like a more formal solution than class="notranslate" is due. Based on the proposals above, I suggest that we add a translate="" global attribute to HTML, with two valid values, "yes" and "no", with the obvious semantics. The value would inherit to descendants, much like "lang". Invalid values (translate="foo", etc) would be ignored. A missing value (translate="") would be treated like translate="yes".

-- Ian Hixon
 
Here's how the translate attribute works:

<p lang="en">Mr <span translate="no">Hope</span> 
is speaking at…</p>
When translating from English to French, the string “Hope” will not be translated to “Espoir” in French.

-- W3C

It is worth noting that Google Translate has featured support for excluding text from translation for sometime, as has Microsoft Translator.  However, the hope is that HTML5 adopting such a practice will provide a standard approach.

Crafter is a modern CMS platform for building modern websites and content-rich digital experiences. Download this eBook now. Brought to you in partnership with Crafter Software.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}