logoalt Hacker News

bentley • today at 7:47 AM • 2 replies • view on HN

For English content I just use <html lang=en>: quiets the validator, makes no difference in rendering, so simple I don’t even think about it.


Replies

charan345 • today at 9:56 AM

It makes more difference than it seems once hyphenation gets involved. hyphens: auto picks the break dictionary from lang, so lang=en and lang=en-GB produce different line breaks in browsers that support it. Spellcheck in contenteditable reads it too. Invisible on short pages, but on long-form text it is the one place the region subtag earns its keep.

ukdstore • today at 10:09 AM

It does change a couple of things. CSS hyphens: auto only hyphenates text that has a lang, and screen readers with automatic language switching use it to pick the voice, so en-GB can get a British voice where one is installed. For a plain English page, lang=en covers most of it.