google / styleguide

Style guides for Google-originated open-source projects
https://google.github.io/styleguide/
Apache License 2.0
37.45k stars 13.3k forks source link

The HTML style guide doesn't list what to do about language tagging #364

Open greggman opened 6 years ago

greggman commented 6 years ago

The HTML style guide says to not use the <html> tag

The W3 site says to always use the HTML tag because you need to specify the language as in

<html lang="ja">

The google HTML guide does not say how to deal with language.

Setting the language is often important because browsers will often guess wrong and offer to translate pages for which no translation should have been offered.

Asking the server to send the correct http header seems right out. For one it requires the server to maintain some kind of metadata about each file. metadata that might get out of sync and metadata that might not be in control of the person creating the document.

It seems like google's style guide should say what to do here.

tonyruscoe commented 6 years ago

Hi Greggman. Apologies for the delay in responding to this too!

While the HTML/CSS Style Guide recommendation to omit optional tags is an optional recommendation, we might want to clarify that including a lang attribute is good practice. I’ll think about this one and check whether there are any reasons why we wouldn’t want to recommend this.