5 ms·
+1 for the natural language tag. Remember to actually update it to the language used on the site. I regularily stumble across pages with a wrong language decl
by mlang23 5y ago
+1 for the natural language tag. Remember to actually update it to the language used on the site. I regularily stumble across pages with a wrong language declaration. You pretty quickly notice this if you rely on a speech synthesizer to read the page content to you. Just a small change which can make such a big difference :-)
- dheera 5y agoWhy can't the speech synthesizer detect the language, especially when the language of dynamic content may change on the client-side after the page is loaded? Language detection is much easier than synthesis, and one would think that a good synthesizer would devote the 0.1% of their engineering time necessary to have good language detection as well.
- mlang23 5y agoSurprisingly, automatic language detection isn't always reliable. And since the DOM actually has an attribute for this, which can also be placed on individual elements like a p or div, the first choice IMO is to rely on what the site declared.
- harperlee 5y agoYeah in general, explicit declarations should not be overriden by guesswork!
- sswam 5y agoIt seems to me that correctly guessing a natural language is a whole lot easier than speech synthesis. I think it would be more common to have incorrect declarations than detection failures. A bit like how comments describing code are often incorrect because they weren't updated when the code changed.
- harperlee 5y agoI wonder the same about Microsoft Word and Powerpoint. Is it so difficult to guess language in 2021? Particularly, to discern language between spanish and english, if both have already been manually set by the user in the document? It seems so...
- naniwaduni 5y agoPeople routinely manage to have "manually set" the language of documents that are very not English to en-US.
- creatonez 5y ago> especially when the language of dynamic content may change on the client-side after the page is loaded The `lang` attribute can be applied to any element, not just the whole document.
- deleted 5y ago[deleted]
- Mauricebranagh 5y agoBing also uses it for geo targeting I had not thought about accessibility and speech synthesisers - I will add that to our Guidance for developers.
- mlang23 5y agoThat'd be great, thank you!