What is the difference between the 2 lines shown below?:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
<meta http-equiv="content-language" content="en-GB" />
If i didn't have the meta tag, what would be the consequence?
Does the meta one affect screen readers and the top one not? I'm a bit confused as to what exactly they do.
Thanks in advance for any help
Best regards
Skip.
Dive Into Accessibility's Identifying your language page recommends adding as much as possible to handle as many screen readers as you can, depending on your doctype:
The same article also references ISO 639.2 to determine what the value of xml:lang should be, although the XML specification references a separate document, RFC4646 Best Current Practice - Tags For Identifying Languages, which seems to indicate your value of "en-GB" is valid.
Google's Web Authoring Statistics (2005) have the following to say about it:
Further, a thread on webproworld talks about the difference between using http-equiv=content-language and name=language to describe the language of the document and implies that both are necessary.
Finally, refer to the HTML Techniques for Web Content Accessibility Guidelines 1.0 document at W3C for some more recommendations, specifically Identifying the Primary Language.
In conclusion it looks like screen readers are looking at lang attributes more than content-language meta information, but most recommendations I've seen advise using meta data anyway. Especially the Google statistics seem pertinent, so perhaps you should leave both in.
Content-Language
is non-conforming in XHTML5.While it does allow you to specify more than one language, you shouldn't do that (it doesn't help anybody). You should use
xml:lang
attributes on specific elements instead, e.g.W3C I18N FAQ is also clearly against
<meta>
:I believe one advantage of the
<meta>
version is that you can specify multiple languages, as in<meta http-equiv="Content-Language" content="en-GB, fr" />
, for example. Have a look at this for a more in-depth examination of the subject.As far as I know, meta http-equiv is only required (if at all) for HTML documents (not XHTML), because XHTML allows to specify the language using xml:lang.
So, no difference, the second line is just redundant.
The HTTP/1.0 RFC 1945 says the Content-Language header field represents "the languages of the intended audience".
HTML4 and XHTML1.x treat the meta http-equiv tag as the same information embedded in the html document rather than the HTTP header.
On the other hand, xml:lang and the html lang attribute identify the language of the document, or the fragment contained within the element on which the attribute appears.
So, suppose you had a document that was primarily in French for the purpose of teaching French to English speakers, the content-language would be en-GB, en-US (say), while the xml:lang attribute would be fr-FR.
However, HTML 5 changes this, and the meta http-equiv="content-language" is considered non-conforming HTML which nevertheless defines the document-wide default language, and only supports a single language so is effectively identical to xml:lang on the html element. I can't say I understand the reasoning behind this change but Daniel Glazman and Ian Hickson discuss it at the thread starting at http://lists.w3.org/Archives/Public/public-html/2008Nov/0083.html