Html5-boilerplate: Revisit lang attribute

Created on 27 Jul 2016  ·  5Comments  ·  Source: h5bp/html5-boilerplate

I maintain the W3C HTML Checker and in looking at statistics logged by it I notice there are a significant number of sites built from HTML5 Boilerplate that have <html class="no-js" lang="">. That is, they have the empty string as the value for the lang attribute, even when the document is clearly in English or another identifiable language.

I think this problem could maybe be prevented if HTML5 Boilerplate instead used something like <html class="no-js" lang="CHANGE_ME"> rather than <html class="no-js" lang="">.

awaiting feedback

Most helpful comment

Discussion that created the current format: #1542
Discussion before that (where we removed the lang attribute altogether): #1110

I'm against "change_me" or "change." All that will do is spread a meaningless language attribute. That works for no one. If we were going to do that, we might as well go back to lang="en" which would at least be valid some of the time. People don't look at it at all. That's always been the problem.

An empty lang attribute is what you're supposed to use if the language is undetermined.

All 5 comments

What about adding an HTML comment encouraging them to make the change? That seems more consistent with the current tips (like changing the GA tracking code)

What about adding an HTML comment encouraging them to make the change? That seems more consistent with the current tips (like changing the GA tracking code)

Yeah I think that would work fine too.

As far as real-world sites that have this issue, a couple of the more well-known ones I’ve noticed are https://www.bookofthemonth.com/ and https://www.thehartford.com/ but there are many more.

Discussion that created the current format: #1542
Discussion before that (where we removed the lang attribute altogether): #1110

I'm against "change_me" or "change." All that will do is spread a meaningless language attribute. That works for no one. If we were going to do that, we might as well go back to lang="en" which would at least be valid some of the time. People don't look at it at all. That's always been the problem.

An empty lang attribute is what you're supposed to use if the language is undetermined.

Closing because I don't think there's a better answer. I've got some thoughts on how we might do some things going forward that might help this (and some other things) but... nothing for now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

roblarsen picture roblarsen  ·  9Comments

roblarsen picture roblarsen  ·  5Comments

gaurav21r picture gaurav21r  ·  21Comments

coliff picture coliff  ·  14Comments

amilajack picture amilajack  ·  19Comments