4 ms·
still, who uses it for what? browsers dont change behaviour because of it, search engines ignore it, users dont see it.
by franze 9y ago
still, who uses it for what? browsers dont change behaviour because of it, search engines ignore it, users dont see it.
- robin_reala 9y ago1. The main reason is screen readers. Imagine a screen reader trying to pronounce ‘Je ne regrette rien’ with an English voice, then imagine the same with a French voice. 2. I’d be surprised if search engines didn’t use it at least as a flag for content language (although I’m sure that it‘s only supplemental at best). 3. Styling based on language. CSS has a :lang() pseudoclass selector so you can do p:lang(en) { color: red; } p:lang(fr) { color: blue; } . Or tie quote styles to language based on generated content. Or most usefully adjust font metrics based on language for multilingual sites (typically you’d want to boost the font size a little for Chinese or Japanese as there are less characters for same information, but each character is a little more dense).
- ozaark 9y agoActually, browsers do change behavior because of it[1], and users do get affected by it[2]. Google have said last year they ignore the lang tag but they do use the hreflang attribute[3] [1] https://www.w3.org/International/tests/repo/results/the-lang-attribute#basics https://www.w3.org/International/tests/repo/results/the-lang... [2] http://accessibility.psu.edu/foreignlanguages/langtaghtml/#about http://accessibility.psu.edu/foreignlanguages/langtaghtml/#a... [3] https://www.seroundtable.com/google-ignores-the-html-lang-attribute-22974.html https://www.seroundtable.com/google-ignores-the-html-lang-at...