RE: Updated tests & results: Language declarations

Thanks to Leif for pointing out a serious error in test 3 and prompting me to write some additional tests.  I have added 3 more tests, made editorial changes to the existing tests, and updated the results page accordingly.  Hopefully, things are looking better now.

The latest version of the results summary now says:

Declaring the language in the html tag works for all features we know to be supported.

A default language declared in the HTTP header is not recognized by any user agent for automatic font assignment. It is, however, recognized by Firefox for use of the :lang pseudo-attribute.

Where multiple languages are declared in the HTTP header, again only Firefox took advantage of that. What was surprising was that both the first and second values were recognized. This means that there is a lack of clarity about what the actual language of the text is at any given point.

IE7 and Opera did not recognize language declarations in the meta tag.

Firefox was able to detect language declared in the meta tag, although only for application of :lang (which is the same as Firefox behavior regarding the HTTP header). If multiple languages are declared in the meta tag, Firefox labels the document text with multiple languages. This leads to predictable problems. An small bit of extra testing showed that if you introduce a rule that matches one of the other languages declared, the rule affects the whole document, regardless of any other in-element language declarations in the document! (See this screen grab, that shows the effect of adding the rule :lang(zh) { background-color: #ff6633; color: white; font-weight: bold; }. Note that the elements containing English text have explicit markup saying lang="en", so they should not be changed by this rule. )

Safari and IE8beta also detected language from the meta tag, but again only for :lang application (which is a distinction that IE8 didn't make in the earlier test). Note that neither of these user agents recognized declarations in the HTTP header declaration. Significantly, also, if multiple values were supplied in the meta tag, neither of these user agents applied any changes to the document (unlike Firefox).

When language is declared differently in the html lang attribute and the meta tag, all browsers ignore the meta tag and use the lang attribute value. This seems consistent with the fact that in the HTML 4.01 spec Content-Language declared in the HTTP header has a lower priority than a language declaration using a language attribute on the html tag.

The lack of widespread recognition of language declarations in the HTTP header and the meta tag and the idiosyncratic results of using the meta tag contrast with the recognition in all tests of the lang attribute on the html element. This indicates that it is best for content authors and developers to use the attribute for declaring the default text processing language. The W3C I18n Activity proposes that the meta element and the HTTP header are better suited for declaring metadata about the intended audience of a document, which would also fit with these findings.

Richard Ishida
Internationalization Lead
W3C (World Wide Web Consortium)

> -----Original Message-----
> From: [mailto:www-international-
>] On Behalf Of Richard Ishida
> Sent: 15 August 2008 12:07
> To:
> Subject: Updated tests & results: Language declarations
> These tests examine whether language information is available for text processing
> when declared in various different ways.
> The format of the tests was improved, and the 6th test page was dropped (dealing
> with language attributes on block elements) since it replicates tests elsewhere.
> The results were rewritten to reflect behavior of the latest major browsers.
> I would welcome reports of findings for major browsers on Mac and Linux
> platforms.

Received on Friday, 15 August 2008 19:26:06 UTC