WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Use of the LANG attribute

for

From: Jukka K. Korpela
Date: Feb 15, 2005 1:16PM


On Tue, 15 Feb 2005, norman.b.robinson wrote:

> The actual RFC gives examples of purpose and use.
> http://www.ietf.org/rfc/rfc1766.txt.

RFC 1766 was obsoleted by RFC 3066 in January 2001, i.e. over four years
ago.

> As a practical matter, I think it should be used for content
> external/embedded from the web page you are on, such as an audio file or
> video so you can determine what language it is without understanding
> that language.

As a theoretical matter, language codes can be assigned to non-HTML
resources in several ways, but LANG attribute affects only content in the
document itself (though embedded content is subject to dispute); for
linked content, you would use HREFLANG.

As a practical matter, it hardly matters at present. Have you got some
evidence of actual use of such metainformation at present? The only I know
is that browsers may let the user query the properties of an element, and
get information like the language. But very few people know about such
possibilities.

> I simply wouldn't identify the world as a foreign
> language for the online shopping application you reference. As a
> customer I want to send my five year old to order "Duck La'Orange" and
> expect it to be a BRANDING or PRODUCT selection title, not understand it
> means "orange duck" (if that is, in fact, what it means ;)

The words are still in some language, even if they constitute a proper
name. Which language would that be? According to WAI guidelines, you must
use markup to indicate any language change in a document. Whether the
requirement is reasonable is a different matter - WAI guidelines
themselves don't satisfy the requirement. But for purposes such as speech
generation, markup for language in a product title would appear to be the
right thing.

> The DOCTYPE is for marking your content target. E.g., <!DOCTYPE HTML
> PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">. The DOCTYPE Language
> (listing of possible codes:
> http://www.oasis-open.org/cover/iso639a.html)

That document is neither normative nor up-to-date any more. Authoritative
information about ISO 639 codes is available from
http://www.loc.gov/standards/iso639-2/

The string "EN" in the DOCTYPE declaration indicates the language of the
Document Type Definition. Roughly speaking, it is the language that was
used when writing the HTML specification. It has nothing to do with the
language of the content of an HTML document, and it would be an error to
replace it by anything else.

> Specifies the public text language,

Yes, but few people know what that _means_.

> the natural language encoding system used in the creation
> of the referenced object - the default web content.

Absolutely not.

> Note, to keep this relevant to this lists purpose, this can be important
> to assistive technologies in general. I.e., Web Accessibility Initiative
> checkpoint 3.2 (http://www.w3.org/WAI/wcag-curric/sam29-0.htm).

You are referring to curriculum material, which might be useful reading.
It is not normative however. And that particular page contains, among
other things, incorrect information (which is in contradiction with W3C
recommendations on HTML) about the DOCTYPE declaration, for example.
Still worse, the page is _about_ formal syntax. Let's just pretend that
we didn't see that piece of confusion.

--
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/