W3C home > Mailing lists > Public > www-international@w3.org > July to September 2008

RE: Updated tests & results: Language declarations

From: Richard Ishida <ishida@w3.org>
Date: Fri, 15 Aug 2008 20:25:33 +0100
To: "'Richard Ishida'" <ishida@w3.org>, <www-international@w3.org>
Message-ID: <00d601c8ff0c$b0552680$10ff7380$@org>

http://www.w3.org/International/tests/sec-lang-decl-0
 
http://www.w3.org/International/tests/results/results-lang-declaration

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)

http://www.w3.org/International/
http://rishida.net/



> -----Original Message-----
> From: www-international-request@w3.org [mailto:www-international-
> request@w3.org] On Behalf Of Richard Ishida
> Sent: 15 August 2008 12:07
> To: www-international@w3.org
> Subject: Updated tests & results: Language declarations
> 
> 
> http://www.w3.org/International/tests/sec-lang-decl-0
> 
> http://www.w3.org/International/tests/results/results-lang-declaration
> 
> 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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 2 June 2009 19:17:18 GMT