Summarized test results:
HTML5, the lang attribute

Intended audience: users, HTML coders, script developers, CSS coders, Web project managers, and anyone who wants to know how language declarations work in current browsers.

Updated

These tests check whether user agents recognize language declarations for HTML documents, and apply the expected prioritisation in case of mismatches between multiple declarations.

To see the test, click on the link in the left-most column. To see detailed results for a single test, click on a row and look just above the table. The detailed results show the date(s) the test result was recorded, and the version of the browser tested.

Any dependencies are shown in notes above the table, and notes below the table will usually provide any additional useful information, including an explanation of why a result was marked as 'partially successful'.

Key:

pass fail partially successful

Results

Note that these test results are for released versions of the browsers tested. Versions that are still in development may provide better support for these features. The tests do not use any vendor prefixes. Tests that do show support for vendor prefixes are listed further down this page.


Basic declarations

Link (to run test)AssertionFirefoxChromeOperaSafariEdgeIE
lang attribute in html tag
the-lang-attribute-001.html
The browser will recognize a language declared in a lang attribute on the html tag. passpasspasspasspasspass
xml:lang attribute in html tag
the-lang-attribute-002.html
The browser will NOT recognize a language declared in an xml:lang attribute on the html tag. passpasspasspasspasspass
HTTP header
the-lang-attribute-003.html
The browser will recognize a language declared in the HTTP header, when there is no internal language declaration. passpasspasspasspasspass
pragma-set default
the-lang-attribute-004.html
The browser will recognize a language declared in a meta element in the head using http-equiv="Content-Language" content=".." (with a single language tag value), when there is no other language declaration inside the document. passpasspasspasspasspass

Conflicting declarations

Dependencies

  1. the-lang-attribute-005 and the-lang-attribute-006 can be ignored if the above test the-lang-attribute-003 fails.
  2. the-lang-attribute-006 and the-lang-attribute-007 can be ignored if the above test the-lang-attribute-004 fails.
Link (to run test)AssertionFirefoxChromeOperaSafariEdgeIE
HTTP header and html lang
the-lang-attribute-005.html
If there is a conflict between the language declarations in the HTTP header and the html element using lang, the browser will recognize the language declared in the html element. passpasspasspasspasspass
HTTP header and meta element
the-lang-attribute-006.html
If there is a conflict between the language declarations in the HTTP header and the Content-Language meta element, the UA will recognize the language declared in the meta element. passpasspasspasspasspass
html lang and meta elements
the-lang-attribute-007.html
If there is a conflict between the language declared using lang in the html element and that in the meta element, the UA will recognize the language declared in the html element. passpasspasspasspasspass

Empty language value

Dependencies

  1. the-lang-attribute-009 should be ignored if the above test the-lang-attribute-003 fails.
  2. the-lang-attribute-010 should be ignored if the above test the-lang-attribute-004 fails.
Link (to run test)AssertionFirefoxChromeOperaSafariEdgeIE
lang="..." vs lang=""
the-lang-attribute-008.html
If an element contains a lang attribute with an empty value, the value of a lang attribute higher up the document tree will no longer be applied to the content of that element. passpasspasspasspasspass
lang="" vs HTTP
the-lang-attribute-009.html
If the HTTP header contains a language declaration but the html element uses an empty lang value, the UA will not recognize the language declared in the HTTP header. passpasspasspasspasspass
lang="" vs meta Content-Language
the-lang-attribute-010.html
If the meta Content-Language element contains a language declaration but the html element uses an empty lang value, the UA will not recognize the language declared in the meta Content-Language element. passpasspasspasspasspass

Declarations containing multiple languages

Dependencies

  1. the-lang-attribute-011 should be ignored if the above test the-lang-attribute-003 fails.
  2. the-lang-attribute-012 should be ignored if the above test the-lang-attribute-004 fails.
Link (to run test)AssertionFirefoxChromeOperaSafariEdgeIE
Multiple languages in HTTP header
the-lang-attribute-011.html
[Exploratory] The browser will not recognize a language declaration in the HTTP Content Language header when more than one language is declared. failfailfailfailpasspass
Multiple languages in Content-Language meta element
the-lang-attribute-012.html
The UA will not recognize a language declaration in the Content-Language meta element when more than one language is declared. failpasspasspasspasspass

Notes

  1. Again, Firefox set the language of the text to three languages, which doesn't make sense for text-processing.