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

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 UTC