Hacker News new | past | comments | ask | show | jobs | submit login

+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 :-)



Bing also uses it for geo targeting I had not thought about accessibility and speech synthesisers - I will add that to our Guidance for developers.


That'd be great, thank you!


Why 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.


Surprisingly, 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.


Yeah in general, explicit declarations should not be overriden by guesswork!


> 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.


I 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...


People routinely manage to have "manually set" the language of documents that are very not English to en-US.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: