Back

Language

What's the language ?

It is the language in which the content of a web page is written. It is also the element added on the HTML tag that indicates the language of a page. For example, if the content of your page is in English, you must add on the HTML tag lang = "en". 

Why is it important to define the language ?

It is important to define the language of a page because it enables robots to interpret the content (even if Google does not necessarily use it). It is interesting to define it because it helps spell checkers and grammar checkers to verify or ignore it (when it is not in the language of the spell checker).  Defining the language also helps translation tools recognize pages or parts of text in a specific language. Specifying the language also helps speech synthesizers and Braille translators get usable results.

How do I manage the language attribute ? 

The lang attribute can be defined as an HTML attribute, in an HTTP Content-Language header and also in an HTML tag. The language must be valid and defined thanks to its ISO-639 code (i.e. fr, fr-fr, fr-ca, en-us).
Here is how to manage the lang attribute in these different elements : 

Example 1 : Language defined as attribute in the HTML tag

 <html lang="en">

Example2 : Language defined in an HTML tag

<meta http-equiv="content-language" content="en"> 

Several languages can be defined within the same element, but it is preferable to define only one to facilitate the understanding of search engines.  Note that in our analysis, we take into account the first language encountered.

Example 3 : Several languages defined

<meta http-equiv="content-language" content="fr, en">