This is an update to a note originally posted on my blog on January 17. As of yesterday (February 7, 2012), this new attribute is officially part of the HTML5 specification. If you are interested you can read the part of the bug report where this change was accepted.
Back in late 2009 I wrote a little something talking about Google Translate and the risks associated with relying on machine translation for anything critical (“Facebook and Google Want to Translate Your Site“). I even offered some examples of things that are tough to translate.
One real-world example I did not list was when I used machine translation to process a page with someone’s name. The first name we’ll say was “Bill,” but the last name was definitely “Belt.” Somehow instead of “Bill Belt” being retained as his name throughout the article, he was renamed to “Bill of Leather Strap.”
This particular example is one step closer to being a thing of the past. In the latest W3C Open Web Platform Weekly Summary, a new attribute has been announced for HTML5 that will allow authors to exclude specific content from being translated — for any service that will honor it. The announcement:
translateattribute will be added to HTML5. The values are
nowith the same inheritance policy than the
langattribute. The goal is to specify if a piece of text should or not should not be translated automatically.
Of course, if I want to exclude Bill Belt from being translated, I’ll probably have to wrap his name in a
span in order to throw a
translate="no" in there since I doubt I’ll have an otherwise semantic or structural element in place already. This does, however, offer a far better solution than the previous suggestion of using a
class to achieve the same effect.
To be fair, Google Translate already has its own support for excluding content from automatic translation, specifically using
class="notranslate". Head over to the Google Translate Help page and expand the bottom-most option, “General information for webmasters” (nice to see they make it easy for a direct link).
If you are curious about the process this went through to become a change for HTML5, you can see the bug report that started it all back on April 4, 2011: Bug 12417 – HTML5 is missing attribute for specifying translatability of content.
I don’t believe that machine translation is ever a good way to translate or localize content for anything more than casual use. For example, legal matters, healthcare, and things like that are poor candidates for machine translation (I have far more to say on this point in the post linked above). For organizations that do provide manual human translation, this attribute can be a boon to them as well, allowing them to understand pieces of content that do not need to be processed, saving time, effort and cost to everyone in the translation workflow.
As developers it’s our responsibility to make sure it is used correctly, most likely by helping to train content authors.