3 ms·
1. 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 Fren
by robin_reala 9y ago
1. 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).