Language tags are the HTML and XML tags used to indicate the language that is used on a web page (HTML uses the “lang” attribute and XML uses “xml:lang”). These attribute can be assigned to a whole page (i.e. put in the head section of the document) or assigned to just elements that reside on a page (i.e. within span etc elements)
Most language tags consist or a two or three letter language tag, and often this is followed by a two-letter or three-digit region subtag. For example ‘en-US’ would be the language tag for English used in the USA and ‘fr-CA’ would be the language tag used for French speaking Canada (software uses these language and region tags to localise aspects such as date, time, currency etc).
Although W3C recommend using the language tags in your xml and html document, many web developers and programmers choose not to specify a language in their mark up. One of the reasons is likely down to the fact that many search engines (such as google) do not rely on them to identify the language or region the site is intended for. Instead they rely on the actual text that resides on the website and also regional indicators such as the url or folder structure for your site.
Although search engines (and the algorhythms that power them) are getting smarter and smarter, I would always comply with W3C recommendations and utilise language tags within your websites. Here are my reasons why:
Better user experience: Language tags tell software specific information which can help the user have a better experience on your website. For example language tags can assist in identifying particular speech and pronunciations if you have speech synthesizers aligned with your browser – particularly useful for the visually impaired. They can also assist any spelling and grammar check plug in you might have by telling the software which dictionary to use when checking the text.
Playing it safe: Although many search engines suggest they do not use language tags to identify the language used– others do. In an ideal world you want to make sure your site is as accessible as possible – to human visitors and also search bots (not just google) and by using language tags you can help some search bots get a better idea of how and where to index your site more easily. In no way will you be handicapping your site by using these tags. Some older browsers will also use language tags to help identify how to display text properly.
Future-proof your site: Website localisation is ever changing and as software and programming develops and evolves you need to be sure updating your site is as hassle free as possible. By using language tags on a multipage multilingual site you are able to easily identify where your different language are and be able to export to other platforms if needed. You can find a list of language tags by going to IANA (The Internet Assigned Numbers Authority).