Web Development is infinitely more troublesome when you have documents in languages other than American English. The onus is on us web developers and server administrators to make sure browsers and search engines can detect the right language. Here is how you can declare the language of your document in HTML 5.
What is language declaration?
This is a way to specify what language a HTML document or a snippet of HTML text is in. Language declaration does not provide information on character encoding and the text direction (right to left or left to right). Those need to be declared separately.
Why specify a language?
Language information can be used for:
- Text to speech converters (e.g. speak Canadian french rather than french)
- Selecting the right fonts for display (e.g. use traditional chinese script instead of the simplified one)
- Selecting the right dictionary for browser spell-checks in forms (use UK English rather than US English)
- Rendering the page correctly — in short deliver the document in its most natural language as possible.