W3C home > Mailing lists > Public > public-html@w3.org > August 2008

Dealing with conflict in lang and xml:lang

From: Richard Ishida <ishida@w3.org>
Date: Tue, 19 Aug 2008 11:04:40 +0100
To: <public-html@w3.org>
Cc: "'Henri Sivonen'" <hsivonen@iki.fi>, "'Toby A Inkster'" <tai@g5n.co.uk>
Message-ID: <001101c901e2$ffb57ad0$ff207070$@org>

It seems to me that requiring sameness between lang and xml:lang attributes
leads to:

a. difficulty in establishing what sameness means with things like lang="fr"
xml:lang="fr-FR" (which actually mean the same) [Note that in the future
there may be a requirement to see things like en-GB and en-Latin-GB as the
same by BCP 47 matching rules]

b. the question of what to do if they are not equal

I'd have thought that a simpler approach would be to establish precedence
rules, such that if lang and xml:lang appear on the same element, one is
recognized and the other ignored.

This is already recommended by the XHTML 1.0 spec, which says in the
compatibility section:

"Use both the lang and xml:lang attributes when specifying the language of
an element. The value of the xml:lang attribute takes precedence."
http://www.w3.org/TR/xhtml1/#C_7

In fact, you could go further and say that lang and xml:lang are equivalent
markup in the html context, albeit that there are precedence rules when both
are used on the same element.  This would make it unnecessary to use both
lang and xml:lang (frankly a pain in the neck) when authoring XHTML 1.0 that
is served as text/html.  This is also likely to significantly reduce, if not
eliminate, as we go forward, the likelihood of conflict arising from authors
using different declarations, and cases where you'd need to establish
precedence. 

RI


============
Richard Ishida
Internationalization Lead
W3C (World Wide Web Consortium)

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



> -----Original Message-----
> From: public-html-request@w3.org [mailto:public-html-request@w3.org] On
> Behalf Of Henri Sivonen
> Sent: 19 August 2008 09:13
> To: Toby A Inkster
> Cc: public-html@w3.org
> Subject: Re: [Bug 5974] New: Language tag sameness should probably be
ASCII
> case-insensitive
> 
> 
> On Aug 19, 2008, at 10:54, Toby A Inkster wrote:
> 
> > Isn't the following a little more of a grey area?
> >
> > <span lang="fr-FR" xml:lang="fr">
> >
> > Might an improved criterion for conformance be: if @lang and
> > @xml:lang are both present, they must be equal, or one must be a
> > substring of the other, matching the head of the longer string. (All
> > case insensitive.) When the attributes conform to the previous
> > condition, the longer attribute value is taken to be the language of
> > the element.
> 
> 
> I think the spec shouldn't get that kind of complexity.
> 
> The point of the conformance requirement is to allow exactly
> equivalent talismans. The purpose isn't to support elaborate DWIM.
> 
> --
> Henri Sivonen
> hsivonen@iki.fi
> http://hsivonen.iki.fi/
> 
Received on Tuesday, 19 August 2008 10:05:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:22 GMT