W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2010

[widgets PC] i18n comment 20 : Misuse of xml:lang for localization flag

From: Richard Ishida <ishida@w3.org>
Date: Thu, 20 May 2010 18:13:43 +0100
To: <public-i18n-core@w3.org>, <public-webapps@w3.org>
Message-ID: <029401caf83f$cd1df0c0$6759d240$@org>
Comment from the i18n review of:
http://dev.w3.org/2006/waf/widgets/

Comment 20
At http://www.w3.org/International/reviews/0907-widgets-pc/
Editorial/substantive: S
Tracked by: RI

Location in reviewed document:
7.16.1 [http://dev.w3.org/2006/waf/widgets/#example-of-usage9]

Comment: 
Note: I am marking this as closed straight away, since I believe it was not spotted early enough to be corrected. I am recording it here, however, in case it is useful for a future discussion.

 
xml:lang should really only be used to indicate the language of content in an element. If you need to indicate something else, such as the locale for that content for localization purposes, you should use a different attribute. See <a href="http://www.w3.org/International/questions/qa-when-xmllang">xml:lang in XML document schemas</a>. Here not only is xml:lang used incorrectly for that reason, but xml:lang="" is defined to mean that this is the default locale, whereas the XML spec says that that should mean that the language of the content of that element is undetermined (see Tagging text with no language [http://www.w3.org/International/questions/qa-no-language]). 

 
It would have been better to use an attribute such as locale='en', locale='fr', or locale=''. This would be used alongside xml:lang. The former would indicate how to process the document, the latter would be useful for things like spell-checking, voice browsers, etc that need to understand the language of the text they are processing. 

 
This would simplify the code in the example in section 7.16.1. Instead of:

 
<name xml:lang="" dir="ltr"><span xml:lang="en">GPS Weather!</span></name>

 
you could simply use 

 
<name locale="" xml:lang="en" dir="ltr">GPS Weather!</name>




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

http://www.w3.org/International/
http://rishida.net/
Received on Thursday, 20 May 2010 17:14:15 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:38 GMT