Using the lang attribute makes a difference

About a year ago I posted a Quick Tip titled Specify each HTML document’s main natural language. The reason is that software like screen readers can use this info to adjust the way they speak text.

But do they really do that? Well, it depends. You need to use a screen reader that supports language switching and can speak the natural languages of the document you’re viewing. One example of when it works as expected is VoiceOver for the iPhone and for the iPod touch.

Here are a few examples of text in different languages (thank you, Wikipedia).


Välkommen till Wikipedia, den fria encyklopedin som alla kan redigera.


Wikipedia ist ein Projekt zum Aufbau einer Enzyklopädie aus freien Inhalten in allen Sprachen der Welt.


Bienvenue sur Wikipédia, le projet d’encyclopédie libre que vous pouvez améliorer.


Bienvenidos a Wikipedia, la enciclopedia de contenido libre que todos pueden editar.

If you have an iPhone or iPod touch, try loading this page after switching VoiceOver on (in Settings > General > Accessibility > VoiceOver). Each language example should be spoken in a different voice and with correct pronunciation instead of with a heavy English accent. This obviously makes it much easier to understand what VoiceOver is saying.

So yes, specifying the natural language does make a difference.

Posted on April 5, 2010 in Accessibility, (X)HTML