473,657 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: ASP.NET Internationaliz ation bug?

re:
!I found an MSDN document that explains why what I'm trying to do should work

Lee,

From :

http://www.w3.org/TR/REC-xml/

"A special attribute named xml:lang may be inserted in documents to specify the
language used in the contents and attribute values of any element in an XML document."

If anything, I can see xml:lang being declared for specific content values, for example :

<p xml:lang="en-GB">What colour is it?</p>
<p xml:lang="en-US">What color is it?</p>

Then, an xml parser could identify regional US and British spellings but, given that *all* the attribute values
must be in English in an html doc, what would be the purpose of declaring xml:lang for the html markup ?

A similar explanation is given here :
http://www.simonstl.com/xmlprim/xmlupdate/atts.html

---000---
<SECTION>
<DESCRIPTION xml:lang="en">
Caesar begins by describing the geography of Gaul.
</DESCRIPTION>
<QUOTE xml:lang="la">
Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae,
aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli appellantur.
</QUOTE>
---000---

That's perfectly good usage for xml:lang, as a parser could selectively identify content in different languages.

But, it seems to me that setting xml:lang for the html tag's *attribute* values is unneeded, since they must
be in English, and they must be attributes set to a language identifier, as defined by IETF RFC 4646
(http://www.ietf.org/rfc/rfc4646.txt).

So, I think that requisite pretty well establishes the futility
of setting xml:lang for all the attributes in an html document.

If anything, it seems that the xml:lang attribute is included in the
html server tag for compatibility purposes, or perhaps out of ignorance.

If there's a need to identify that the *contents* of a particular markup tag are in a
specific language, that identification can be included in the tag itself, for example :

<div lang="MX-es" xml:lang="MX-es">
Algo de contenido en español mejicano.
</div>

That makes a lot more sense than setting xml:lang for the attribute values in the html tag.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Lee C." <no*****@spamme r.comwrote in message news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>I found an MSDN document that explains why what I'm trying to do should work.

ASP.NET Web Server Controls Overview
http://msdn.microsoft.com/en-us/library/zsyt68f1.aspx

Note the distinction between HTML Server Controls and Web Server Controls in the document. Also, note the explanation
of "pass-through" attributes for HTML Server Controls.

Two quotes that sum it up:
1. Any HTML element on a page can be converted to an HTML server control by adding the attribute runat="server".
2. You can add any attributes you need to an HTML server control and the page framework will render them without
any change in functionality.

, Lee

"Lee C." <no*****@spamme r.comwrote in message news:Oe******** ******@TK2MSFTN GP03.phx.gbl...
>Juan,

I appreciate your trying to help, but you're wrong, and you are the one who is confused. :]

I am *not* disputing that when inserted programmaticall y, the xml:lang attribute renders to the browser. I did just
that as a work around (right after I discovered this bug); but, I should not have to.

I am *not* confusing html attributes with runat="server" attributes, as you call them. Using your logic, none of the
declarative (html) attributes should render to the browser after I add the runat="server" in ASP.NET; yet all of them
(xmlns, lang, and dir) do--except xml:lang.

I started with an html element with 4 attributes (xmlns, lang, xml:lang, and dir) all set declaratively. With *no*
5th attribute of runat="server", all 4 attributes render. If I add the 5th attribute of runat="server", which does
not and should not render, I no longer get all 4 attributes that should render (xmlns, lang, xml:lang, and dir), I
only get 3 (xmlns, lang, and dir). My logic says I should get 4, your says I should get 3? It would be 4 or 0, and
4 is right. Not 0...and not 3.

When I add runat="server", it does not magically make the xml:lang attribute a server-side attribute, while keeping
the other three attributes as "html" attributes. All four are still "html" attributes--which should render.

I think the simplification of my example may be confusing you. It is odd that, in my example, I set runat="server"
but do not have any server-side attributes. (I have all 4 as literal strings, for simplicity of an example.) Well,
in my real-world use, I do have server-side attributes, which I want set declaratively (no code-beside and no
script). I have:

<html runat="server" xmlns="http://www.w3.org/1999/xhtml"
xml:lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
dir="ltr">

Both of those declarative explicit localization expressions should work without my having to write any more
"procedural " (code-beside) code or script. It actually does work fine for the lang attribute--as it should; but not
for the xml:lang attribute--***which is a bug***.

, Lee

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:u0******** ******@TK2MSFTN GP04.phx.gbl...
>>re:
!I think you are misunderstandin g, Juan.

Well, I think you are misunderstandin g *me*.

re:
!I had the xml:lang attribute in the html tag (declaratively) , like this:
...and it renders to the browser, as it should.

Yes, because it's standard html.

re:
!If I simply add runat="server"

That declares the control to run server side.

For any attribute to be programmed server-side you need a script,
just as you need a script to modify any server control's attributes.

Did you run the sample page I sent ?

It iterates throught the attributes for the html server control,
and shows that the xml:lang attribute *is* added programmaticall y.

re:
!If I simply add runat="server", leaving in the xml:lang attribute that
!renders without runat="server", all of the (declarative) attributes are
!rendered to the browser--except the xml:lang attribute! That is a bug.

I think you're confusing html attributes with runat="server" attributes.

Html attributes can be inserted in normal html.
Server-side attributes must be inserted in code.

Maybe I'm not explaining this as well as I should.
Try to get someone else's opinion on this matter, if you don't accept mine.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============= =============== ==========
"Lee C." <no*****@spamme r.comwrote in message news:en******** ******@TK2MSFTN GP04.phx.gbl...
I think you are misunderstandin g, Juan. I had the xml:lang attribute in the html tag (declaratively) , like this:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">

...and it renders to the browser, as it should.

If I simply add runat="server", leaving in the xml:lang attribute that renders without runat="server", all of the
(declarative ) attributes are rendered to the browser--except the xml:lang attribute! That is a bug.

<html runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">

Cordially,
Lee
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:ey******** ******@TK2MSFTN GP02.phx.gbl...
Here's a full example which shows that the xml:lang attribute is added programmaticall y :
>
attributes. aspx:
----------------------
<%@ Page Language="C#" AutoEventWireup ="True" %>
<html xmlns="http://www.w3.org/1999/xhtml" runat="server" id="Myid" >
<script language="C#" runat="server">
void Page_Load(Objec t sender, EventArgs e)
{
Myid.Attrib utes.Add("xml:l ang", "es");
Message.Inn erHtml = "<h4>The html control attributes collection contains:</h4>";
IEnumerat or keys = Myid.Attributes .Keys.GetEnumer ator();
while (keys.MoveNext( ))
{
String key = (String)keys.Cu rrent;
Message.Inn erHtml += key + "=" + Myid.Attributes[key] + "<br />";
}
}
</script>
<head id="Head1" runat="server">
<title>Th e html control attributes collection</title>
</head>
<body>
<form id="Form1" runat="server">
<h3>HtmlCon trol Attribute Collection Example</h3>
<br />
<span id="Message" enableviewstate ="false" runat="server" />
</form>
</body>
</html>
----------------
>
I don't think it's a bug to have to add an attribute programmaticall y,
because the runat="server" tag only *declares* the html control as a programmable control.
>
To actually program it, you must use a script.
>
>
>
>
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=========== =============== ============
"Lee C." <no*****@spamme r.comwrote in message news:e0******** ******@TK2MSFTN GP03.phx.gbl...
>Thanks, Juan.
>>
>I already added similar code to a page event in my masterpage code-beside.
>>
> elHtml.Attribut es.Add("xml:lan g", Resources.Globa lLang.ContentAu dienceLanguage)
>>
>To me, that is a temporary workaround. I still want to understand whether the "eating" of the attribute I
>original ly
>posted about is a bug, or if this is actually happening for a reason.
>>
>Cordiall y,
>Lee
>>
>>
>"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>>Hi, Lee.
>>>
>>re:
>>!<html runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>!no xml:lang attribute is rendered to the browser!
>>!Remove the runat="server", and, voila, the xml:lang attribute is rendered.
>>>
>>Try this :
>>>
>><html xmlns="http://www.w3.org/1999/xhtml" runat="server" id="someID">
>>>
>><script runat="server">
>>someID.At tributes("xml:l ang") = "en-US"
>></script>
>>>
>>>
>>>
>>Juan T. Llibre, asp.net MVP
>>asp.net faq : http://asp.net.do/faq/
>>foros de asp.net, en español : http://asp.net.do/foros/
>>========= =============== ==============
>>>
>>"Lee C." <no****@spam.co mwrote in message news:O%******** ********@TK2MSF TNGP03.phx.gbl. ..
>>>>I think I have discovered a bug in ASP.NET, related to I18N.
>>>>
>>>In ASP.NET 3.5 I have to set runat="server" on the html element to use explicit expressions. It appears that
>>>ASP.NE T
>>>eats the xml:lang attribute on the html element when it is set to runat="server".
>>>>
>>>Of course I want to replace the hardcoded "en-US" values with (resource) explicit expressions; but, for
>>>simplici ty,
>>>try this:
>>>>
>>><html runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>
>>>...And you will find that no xml:lang attribute is rendered to the browser! Remove the runat="server", and,
>>>voila,
>>>the
>>>xml:la ng attribute is rendered. :[
>>>>
>>>...Any ideas?
>>>>
>>>Cordiall y,
>>>Lee
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>
>
>




Jun 27 '08 #1
12 2044
Juan,

In theory, I like your idea of investigating "the standard"; but, in
practice it has serious problems, as it often does. First, you are
referring to the XML standard, which is not as appropriate as HTML and XHTML
standards. Second, none of them are crystal clear on best practices for
I18N. There is a lot of *legal* (by the standard) syntax, that makes no
sense, or makes some sense without being clearly best. The W3C site often
states something to the effect of, "some are doing this, some are doing
that, on your own site, at least do something and only time will tell what
is best."

Check out these fine examples, which mirror my syntax, on the W3C site.

Internationaliz ation Best Practices: Specifying Language in XHTML & HTML
Content
http://www.w3.org/TR/i18n-html-tech-...0429.092928424
Tutorial: Declaring Language in XHTML and HTML (Draft)
http://www.w3.org/International/tuto...Slide0160.html

Juan, you wrote:
But, it seems to me that setting xml:lang for the html tag's *attribute*
values is unneeded, since they must
be in English, and they must be attributes set to a language identifier,
as defined by IETF RFC 4646
(http://www.ietf.org/rfc/rfc4646.txt).
You're not setting it for "the tag's *attribute*", you're setting it for the
*contents*, all contents, of the element (unless overridden by a
sub-setting), which makes perfect sense so that I don't have to set it
individually on every child element--that is the power of a hierarchy! You
seem to be focused on the technical, with some misunderstandin g, versus the
spirit of what we're trying to accomplish: telling user agents who our
intended audiences is, by language, as best we can...which is why I'm *also*
setting lang in the HTTP headers and in page meta tags.

, Lee
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:OY******** ******@TK2MSFTN GP02.phx.gbl...
re:
!I found an MSDN document that explains why what I'm trying to do should
work

Lee,

From :

http://www.w3.org/TR/REC-xml/

"A special attribute named xml:lang may be inserted in documents to
specify the
language used in the contents and attribute values of any element in an
XML document."

If anything, I can see xml:lang being declared for specific content
values, for example :

<p xml:lang="en-GB">What colour is it?</p>
<p xml:lang="en-US">What color is it?</p>

Then, an xml parser could identify regional US and British spellings but,
given that *all* the attribute values
must be in English in an html doc, what would be the purpose of declaring
xml:lang for the html markup ?

A similar explanation is given here :
http://www.simonstl.com/xmlprim/xmlupdate/atts.html

---000---
<SECTION>
<DESCRIPTION xml:lang="en">
Caesar begins by describing the geography of Gaul.
</DESCRIPTION>
<QUOTE xml:lang="la">
Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae,
aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli
appellantur.
</QUOTE>
---000---

That's perfectly good usage for xml:lang, as a parser could selectively
identify content in different languages.

But, it seems to me that setting xml:lang for the html tag's *attribute*
values is unneeded, since they must
be in English, and they must be attributes set to a language identifier,
as defined by IETF RFC 4646
(http://www.ietf.org/rfc/rfc4646.txt).

So, I think that requisite pretty well establishes the futility
of setting xml:lang for all the attributes in an html document.

If anything, it seems that the xml:lang attribute is included in the
html server tag for compatibility purposes, or perhaps out of ignorance.

If there's a need to identify that the *contents* of a particular markup
tag are in a
specific language, that identification can be included in the tag itself,
for example :

<div lang="MX-es" xml:lang="MX-es">
Algo de contenido en español mejicano.
</div>

That makes a lot more sense than setting xml:lang for the attribute values
in the html tag.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Lee C." <no*****@spamme r.comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>>I found an MSDN document that explains why what I'm trying to do should
work.

ASP.NET Web Server Controls Overview
http://msdn.microsoft.com/en-us/library/zsyt68f1.aspx

Note the distinction between HTML Server Controls and Web Server Controls
in the document. Also, note the explanation
of "pass-through" attributes for HTML Server Controls.

Two quotes that sum it up:
1. Any HTML element on a page can be converted to an HTML server
control by adding the attribute runat="server".
2. You can add any attributes you need to an HTML server control and
the page framework will render them without
any change in functionality.

, Lee

"Lee C." <no*****@spamme r.comwrote in message
news:Oe******* *******@TK2MSFT NGP03.phx.gbl.. .
>>Juan,

I appreciate your trying to help, but you're wrong, and you are the one
who is confused. :]

I am *not* disputing that when inserted programmaticall y, the xml:lang
attribute renders to the browser. I did just
that as a work around (right after I discovered this bug); but, I should
not have to.

I am *not* confusing html attributes with runat="server" attributes, as
you call them. Using your logic, none of the
declarative (html) attributes should render to the browser after I add
the runat="server" in ASP.NET; yet all of them
(xmlns, lang, and dir) do--except xml:lang.

I started with an html element with 4 attributes (xmlns, lang, xml:lang,
and dir) all set declaratively. With *no*
5th attribute of runat="server", all 4 attributes render. If I add the
5th attribute of runat="server", which does
not and should not render, I no longer get all 4 attributes that should
render (xmlns, lang, xml:lang, and dir), I
only get 3 (xmlns, lang, and dir). My logic says I should get 4, your
says I should get 3? It would be 4 or 0, and
4 is right. Not 0...and not 3.

When I add runat="server", it does not magically make the xml:lang
attribute a server-side attribute, while keeping
the other three attributes as "html" attributes. All four are still
"html" attributes--which should render.

I think the simplification of my example may be confusing you. It is
odd that, in my example, I set runat="server"
but do not have any server-side attributes. (I have all 4 as literal
strings, for simplicity of an example.) Well,
in my real-world use, I do have server-side attributes, which I want set
declarative ly (no code-beside and no
script). I have:

<html runat="server" xmlns="http://www.w3.org/1999/xhtml"
xml:lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
dir="ltr">

Both of those declarative explicit localization expressions should work
without my having to write any more
"procedural " (code-beside) code or script. It actually does work fine
for the lang attribute--as it should; but not
for the xml:lang attribute--***which is a bug***.

, Lee

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:u0****** ********@TK2MSF TNGP04.phx.gbl. ..
re:
!I think you are misunderstandin g, Juan.

Well, I think you are misunderstandin g *me*.

re:
!I had the xml:lang attribute in the html tag (declaratively) , like
this:
...and it renders to the browser, as it should.

Yes, because it's standard html.

re:
!If I simply add runat="server"

That declares the control to run server side.

For any attribute to be programmed server-side you need a script,
just as you need a script to modify any server control's attributes.

Did you run the sample page I sent ?

It iterates throught the attributes for the html server control,
and shows that the xml:lang attribute *is* added programmaticall y.

re:
!If I simply add runat="server", leaving in the xml:lang attribute
that
!renders without runat="server", all of the (declarative) attributes
are
!rendered to the browser--except the xml:lang attribute! That is a
bug.

I think you're confusing html attributes with runat="server"
attributes .

Html attributes can be inserted in normal html.
Server-side attributes must be inserted in code.

Maybe I'm not explaining this as well as I should.
Try to get someone else's opinion on this matter, if you don't accept
mine.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============ =============== ===========
"Lee C." <no*****@spamme r.comwrote in message
news:en***** *********@TK2MS FTNGP04.phx.gbl ...
>I think you are misunderstandin g, Juan. I had the xml:lang attribute
>in the html tag (declaratively) , like this:
>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"
lang="en-US" dir="ltr">
>
...and it renders to the browser, as it should.
>
If I simply add runat="server", leaving in the xml:lang attribute that
renders without runat="server", all of the
(declarativ e) attributes are rendered to the browser--except the
xml:lang attribute! That is a bug.
>
<html runat="server" xmlns="http://www.w3.org/1999/xhtml"
xml:lang="e n-US" lang="en-US" dir="ltr">
>
Cordially ,
Lee
>
>
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:ey**** **********@TK2M SFTNGP02.phx.gb l...
>Here's a full example which shows that the xml:lang attribute is
>added programmaticall y :
>>
>attributes .aspx:
>----------------------
><%@ Page Language="C#" AutoEventWireup ="True" %>
><html xmlns="http://www.w3.org/1999/xhtml" runat="server" id="Myid" >
><script language="C#" runat="server">
>void Page_Load(Objec t sender, EventArgs e)
>{
>Myid.Attri butes.Add("xml: lang", "es");
>Message.In nerHtml = "<h4>The html control attributes collection
>contains :</h4>";
>IEnumerato r keys = Myid.Attributes .Keys.GetEnumer ator();
>while (keys.MoveNext( ))
>{
>String key = (String)keys.Cu rrent;
>Message.In nerHtml += key + "=" + Myid.Attributes[key] + "<br />";
>}
>}
></script>
><head id="Head1" runat="server">
><title>T he html control attributes collection</title>
></head>
><body>
><form id="Form1" runat="server">
><h3>HtmlCo ntrol Attribute Collection Example</h3>
><br />
><span id="Message" enableviewstate ="false" runat="server" />
></form>
></body>
></html>
>----------------
>>
>I don't think it's a bug to have to add an attribute
>programmat ically,
>because the runat="server" tag only *declares* the html control as a
>programmab le control.
>>
>To actually program it, you must use a script.
>>
>>
>>
>>
>Juan T. Llibre, asp.net MVP
>asp.net faq : http://asp.net.do/faq/
>foros de asp.net, en español : http://asp.net.do/foros/
>========== =============== =============
>"Lee C." <no*****@spamme r.comwrote in message
>news:e0*** ***********@TK2 MSFTNGP03.phx.g bl...
>>Thanks, Juan.
>>>
>>I already added similar code to a page event in my masterpage
>>code-beside.
>>>
>> elHtml.Attribut es.Add("xml:lan g",
>>Resources .GlobalLang.Con tentAudienceLan guage)
>>>
>>To me, that is a temporary workaround. I still want to understand
>>whether the "eating" of the attribute I
>>originall y
>>posted about is a bug, or if this is actually happening for a
>>reason.
>>>
>>Cordially ,
>>Lee
>>>
>>>
>>"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
>>news:%2** **************@ TK2MSFTNGP03.ph x.gbl...
>>>Hi, Lee.
>>>>
>>>re:
>>>!<html runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>>xml:lang ="en-US" lang="en-US" dir="ltr">
>>>!no xml:lang attribute is rendered to the browser!
>>>!Remov e the runat="server", and, voila, the xml:lang attribute is
>>>rendered .
>>>>
>>>Try this :
>>>>
>>><html xmlns="http://www.w3.org/1999/xhtml" runat="server"
>>>id="some ID">
>>>>
>>><scrip t runat="server">
>>>someID.A ttributes("xml: lang") = "en-US"
>>></script>
>>>>
>>>>
>>>>
>>>Juan T. Llibre, asp.net MVP
>>>asp.ne t faq : http://asp.net.do/faq/
>>>foros de asp.net, en español : http://asp.net.do/foros/
>>>======== =============== ===============
>>>>
>>>"Lee C." <no****@spam.co mwrote in message
>>>news:O%* *************** @TK2MSFTNGP03.p hx.gbl...
>>>>>I think I have discovered a bug in ASP.NET, related to I18N.
>>>>>
>>>>In ASP.NET 3.5 I have to set runat="server" on the html element to
>>>>use explicit expressions. It appears that
>>>>ASP.N ET
>>>>eats the xml:lang attribute on the html element when it is set to
>>>>runat=" server".
>>>>>
>>>>Of course I want to replace the hardcoded "en-US" values with
>>>>(resour ce) explicit expressions; but, for
>>>>simplic ity,
>>>>try this:
>>>>>
>>>><html runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>>>xml:lan g="en-US" lang="en-US" dir="ltr">
>>>>>
>>>>...An d you will find that no xml:lang attribute is rendered to the
>>>>browser ! Remove the runat="server", and,
>>>>voila ,
>>>>the
>>>>xml:lan g attribute is rendered. :[
>>>>>
>>>>...An y ideas?
>>>>>
>>>>Cordial ly,
>>>>Lee
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>>
>
>




Jun 28 '08 #2
re:
!versus the spirit of what we're trying to accomplish: telling user agents who our
!intended audiences is, by language, as best we can...which is why I'm *also*
!setting lang in the HTTP headers and in page meta tags

What ? You don't set a language/culture in web.config, too ?
There's a use for overkill ! ( only kidding... )

I don't see too clearly the purpose of declaring a single language for a web page.

I do see a use for declaring specific language attributes in a *collection* of xml documents,
so that individual documents can be parsed for a particular language content.

But, ymmv...

I'd still be interested in knowing what the reply is to your bug report.
I bet you'll get back : "That's by design". <g>

Don't forget to let us all know what happens with that, OK ?
Thanks for an interesting discussion.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Lee C." <no****@spam.co mwrote in message news:en******** *****@TK2MSFTNG P05.phx.gbl...
Juan,

In theory, I like your idea of investigating "the standard"; but, in practice it has serious problems, as it often
does. First, you are referring to the XML standard, which is not as appropriate as HTML and XHTML standards. Second,
none of them are crystal clear on best practices for I18N. There is a lot of *legal* (by the standard) syntax, that
makes no sense, or makes some sense without being clearly best. The W3C site often states something to the effect of,
"some are doing this, some are doing that, on your own site, at least do something and only time will tell what is
best."

Check out these fine examples, which mirror my syntax, on the W3C site.

Internationaliz ation Best Practices: Specifying Language in XHTML & HTML Content
http://www.w3.org/TR/i18n-html-tech-...0429.092928424
Tutorial: Declaring Language in XHTML and HTML (Draft)
http://www.w3.org/International/tuto...Slide0160.html

Juan, you wrote:
>But, it seems to me that setting xml:lang for the html tag's *attribute* values is unneeded, since they must
be in English, and they must be attributes set to a language identifier, as defined by IETF RFC 4646
(http://www.ietf.org/rfc/rfc4646.txt).

You're not setting it for "the tag's *attribute*", you're setting it for the *contents*, all contents, of the element
(unless overridden by a sub-setting), which makes perfect sense so that I don't have to set it individually on every
child element--that is the power of a hierarchy! You seem to be focused on the technical, with some misunderstandin g,
versus the spirit of what we're trying to accomplish: telling user agents who our intended audiences is, by language,
as best we can...which is why I'm *also* setting lang in the HTTP headers and in page meta tags.

, Lee
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:OY******** ******@TK2MSFTN GP02.phx.gbl...
>re:
!I found an MSDN document that explains why what I'm trying to do should work

Lee,

From :

http://www.w3.org/TR/REC-xml/

"A special attribute named xml:lang may be inserted in documents to specify the
language used in the contents and attribute values of any element in an XML document."

If anything, I can see xml:lang being declared for specific content values, for example :

<p xml:lang="en-GB">What colour is it?</p>
<p xml:lang="en-US">What color is it?</p>

Then, an xml parser could identify regional US and British spellings but, given that *all* the attribute values
must be in English in an html doc, what would be the purpose of declaring xml:lang for the html markup ?

A similar explanation is given here :
http://www.simonstl.com/xmlprim/xmlupdate/atts.html

---000---
<SECTION>
<DESCRIPTION xml:lang="en">
Caesar begins by describing the geography of Gaul.
</DESCRIPTION>
<QUOTE xml:lang="la">
Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae,
aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli appellantur.
</QUOTE>
---000---

That's perfectly good usage for xml:lang, as a parser could selectively identify content in different languages.

But, it seems to me that setting xml:lang for the html tag's *attribute* values is unneeded, since they must
be in English, and they must be attributes set to a language identifier, as defined by IETF RFC 4646
(http://www.ietf.org/rfc/rfc4646.txt).

So, I think that requisite pretty well establishes the futility
of setting xml:lang for all the attributes in an html document.

If anything, it seems that the xml:lang attribute is included in the
html server tag for compatibility purposes, or perhaps out of ignorance.

If there's a need to identify that the *contents* of a particular markup tag are in a
specific language, that identification can be included in the tag itself, for example :

<div lang="MX-es" xml:lang="MX-es">
Algo de contenido en español mejicano.
</div>

That makes a lot more sense than setting xml:lang for the attribute values in the html tag.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============== =============== =========
"Lee C." <no*****@spamme r.comwrote in message news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>>>I found an MSDN document that explains why what I'm trying to do should work.

ASP.NET Web Server Controls Overview
http://msdn.microsoft.com/en-us/library/zsyt68f1.aspx

Note the distinction between HTML Server Controls and Web Server Controls in the document. Also, note the
explanation
of "pass-through" attributes for HTML Server Controls.

Two quotes that sum it up:
1. Any HTML element on a page can be converted to an HTML server control by adding the attribute runat="server".
2. You can add any attributes you need to an HTML server control and the page framework will render them without
any change in functionality.

, Lee

"Lee C." <no*****@spamme r.comwrote in message news:Oe******** ******@TK2MSFTN GP03.phx.gbl...
Juan,

I appreciate your trying to help, but you're wrong, and you are the one who is confused. :]

I am *not* disputing that when inserted programmaticall y, the xml:lang attribute renders to the browser. I did
just
that as a work around (right after I discovered this bug); but, I should not have to.

I am *not* confusing html attributes with runat="server" attributes, as you call them. Using your logic, none of
the
declarativ e (html) attributes should render to the browser after I add the runat="server" in ASP.NET; yet all of
them
(xmlns, lang, and dir) do--except xml:lang.

I started with an html element with 4 attributes (xmlns, lang, xml:lang, and dir) all set declaratively. With *no*
5th attribute of runat="server", all 4 attributes render. If I add the 5th attribute of runat="server", which does
not and should not render, I no longer get all 4 attributes that should render (xmlns, lang, xml:lang, and dir), I
only get 3 (xmlns, lang, and dir). My logic says I should get 4, your says I should get 3? It would be 4 or 0,
and
4 is right. Not 0...and not 3.

When I add runat="server", it does not magically make the xml:lang attribute a server-side attribute, while keeping
the other three attributes as "html" attributes. All four are still "html" attributes--which should render.

I think the simplification of my example may be confusing you. It is odd that, in my example, I set runat="server"
but do not have any server-side attributes. (I have all 4 as literal strings, for simplicity of an example.)
Well,
in my real-world use, I do have server-side attributes, which I want set declaratively (no code-beside and no
script). I have:

<html runat="server" xmlns="http://www.w3.org/1999/xhtml"
xml:lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
dir="ltr">

Both of those declarative explicit localization expressions should work without my having to write any more
"procedura l" (code-beside) code or script. It actually does work fine for the lang attribute--as it should; but
not
for the xml:lang attribute--***which is a bug***.

, Lee

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:u0******** ******@TK2MSFTN GP04.phx.gbl...
re:
!I think you are misunderstandin g, Juan.
>
Well, I think you are misunderstandin g *me*.
>
re:
!I had the xml:lang attribute in the html tag (declaratively) , like this:
>...and it renders to the browser, as it should.
>
Yes, because it's standard html.
>
re:
!If I simply add runat="server"
>
That declares the control to run server side.
>
For any attribute to be programmed server-side you need a script,
just as you need a script to modify any server control's attributes.
>
Did you run the sample page I sent ?
>
It iterates throught the attributes for the html server control,
and shows that the xml:lang attribute *is* added programmaticall y.
>
re:
!If I simply add runat="server", leaving in the xml:lang attribute that
!renders without runat="server", all of the (declarative) attributes are
!rendered to the browser--except the xml:lang attribute! That is a bug.
>
I think you're confusing html attributes with runat="server" attributes.
>
Html attributes can be inserted in normal html.
Server-side attributes must be inserted in code.
>
Maybe I'm not explaining this as well as I should.
Try to get someone else's opinion on this matter, if you don't accept mine.
>
>
>
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=========== =============== ============
"Lee C." <no*****@spamme r.comwrote in message news:en******** ******@TK2MSFTN GP04.phx.gbl...
>>I think you are misunderstandin g, Juan. I had the xml:lang attribute in the html tag (declaratively) , like this:
>>
><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>
>...and it renders to the browser, as it should.
>>
>If I simply add runat="server", leaving in the xml:lang attribute that renders without runat="server", all of the
>(declarati ve) attributes are rendered to the browser--except the xml:lang attribute! That is a bug.
>>
><html runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>
>Cordiall y,
>Lee
>>
>>
>"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:ey******** ******@TK2MSFTN GP02.phx.gbl...
>>Here's a full example which shows that the xml:lang attribute is added programmaticall y :
>>>
>>attribute s.aspx:
>>----------------------
>><%@ Page Language="C#" AutoEventWireup ="True" %>
>><html xmlns="http://www.w3.org/1999/xhtml" runat="server" id="Myid" >
>><script language="C#" runat="server">
>>void Page_Load(Objec t sender, EventArgs e)
>>{
>>Myid.Attr ibutes.Add("xml :lang", "es");
>>Message.I nnerHtml = "<h4>The html control attributes collection contains:</h4>";
>>IEnumerat or keys = Myid.Attributes .Keys.GetEnumer ator();
>>while (keys.MoveNext( ))
>>{
>>String key = (String)keys.Cu rrent;
>>Message.I nnerHtml += key + "=" + Myid.Attributes[key] + "<br />";
>>}
>>}
>></script>
>><head id="Head1" runat="server">
>><title>Th e html control attributes collection</title>
>></head>
>><body>
>><form id="Form1" runat="server">
>><h3>HtmlC ontrol Attribute Collection Example</h3>
>><br />
>><span id="Message" enableviewstate ="false" runat="server" />
>></form>
>></body>
>></html>
>>----------------
>>>
>>I don't think it's a bug to have to add an attribute programmaticall y,
>>because the runat="server" tag only *declares* the html control as a programmable control.
>>>
>>To actually program it, you must use a script.
>>>
>>>
>>>
>>>
>>Juan T. Llibre, asp.net MVP
>>asp.net faq : http://asp.net.do/faq/
>>foros de asp.net, en español : http://asp.net.do/foros/
>>========= =============== ==============
>>"Lee C." <no*****@spamme r.comwrote in message news:e0******** ******@TK2MSFTN GP03.phx.gbl...
>>>Thanks , Juan.
>>>>
>>>I already added similar code to a page event in my masterpage code-beside.
>>>>
>>> elHtml.Attribut es.Add("xml:lan g", Resources.Globa lLang.ContentAu dienceLanguage)
>>>>
>>>To me, that is a temporary workaround. I still want to understand whether the "eating" of the attribute I
>>>original ly
>>>posted about is a bug, or if this is actually happening for a reason.
>>>>
>>>Cordiall y,
>>>Lee
>>>>
>>>>
>>>"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>>>>Hi, Lee.
>>>>>
>>>>re:
>>>>!<htm l runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>!no xml:lang attribute is rendered to the browser!
>>>>!Remo ve the runat="server", and, voila, the xml:lang attribute is rendered.
>>>>>
>>>>Try this :
>>>>>
>>>><html xmlns="http://www.w3.org/1999/xhtml" runat="server" id="someID">
>>>>>
>>>><scri pt runat="server">
>>>>someID. Attributes("xml :lang") = "en-US"
>>>></script>
>>>>>
>>>>>
>>>>>
>>>>Juan T. Llibre, asp.net MVP
>>>>asp.n et faq : http://asp.net.do/faq/
>>>>foros de asp.net, en español : http://asp.net.do/foros/
>>>>======= =============== =============== =
>>>>>
>>>>"Lee C." <no****@spam.co mwrote in message news:O%******** ********@TK2MSF TNGP03.phx.gbl. ..
>>>>>>I think I have discovered a bug in ASP.NET, related to I18N.
>>>>>>
>>>>>In ASP.NET 3.5 I have to set runat="server" on the html element to use explicit expressions. It appears that
>>>>>ASP.NE T
>>>>>eats the xml:lang attribute on the html element when it is set to runat="server".
>>>>>>
>>>>>Of course I want to replace the hardcoded "en-US" values with (resource) explicit expressions; but, for
>>>>>simpli city,
>>>>>try this:
>>>>>>
>>>>><htm l runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>
>>>>>...A nd you will find that no xml:lang attribute is rendered to the browser! Remove the runat="server", and,
>>>>>voil a,
>>>>>the
>>>>>xml:la ng attribute is rendered. :[
>>>>>>
>>>>>...A ny ideas?
>>>>>>
>>>>>Cordia lly,
>>>>>Lee
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>
>




Jun 28 '08 #3
Juan,

My use of language and culture in ASP.Net is a bit different than most. I
have registered numerous country-code-specific domains (mysite.ca,
mysite.co.uk, mysite.com.au, etc.), which resolve to a singular "ASP.Net Web
Site". Nothing new there. However, I'm not doing the ASP.Net usual of
letting the user agent (HTTP header 'accept-language') determine which
language visitors get; I have the country-code TLD drive it. Also, it's not
just the language of my content that varies by cc TLD, it's the content,
too; but, lang attributes play a critical role in informing user agents
(including search engine bots) for what "country" my content is aimed.

I have already found, first-hand, that the better of the major search
engines use the cc TLD *and* the HTML lang/xml:lang to determine whether a
domain's documents (mysite.com.au/my-document.aspx) should show up when a
searcher searches with the 'Only from Australia' checkbox checked on
Live.com, for example.

I'm not setting lang attributes for fun; I'm doing it to correct search
engine results. ASP.NET should make it easy for me--and, it does, but there
is a bug in the implementation.

I appreciate your interest and effort to help.

, Lee
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:uB******** ******@TK2MSFTN GP03.phx.gbl...
re:
!versus the spirit of what we're trying to accomplish: telling user
agents who our
!intended audiences is, by language, as best we can...which is why I'm
*also*
!setting lang in the HTTP headers and in page meta tags

What ? You don't set a language/culture in web.config, too ?
There's a use for overkill ! ( only kidding... )

I don't see too clearly the purpose of declaring a single language for a
web page.

I do see a use for declaring specific language attributes in a
*collection* of xml documents,
so that individual documents can be parsed for a particular language
content.

But, ymmv...

I'd still be interested in knowing what the reply is to your bug report.
I bet you'll get back : "That's by design". <g>

Don't forget to let us all know what happens with that, OK ?
Thanks for an interesting discussion.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Lee C." <no****@spam.co mwrote in message
news:en******** *****@TK2MSFTNG P05.phx.gbl...
>Juan,

In theory, I like your idea of investigating "the standard"; but, in
practice it has serious problems, as it often does. First, you are
referring to the XML standard, which is not as appropriate as HTML and
XHTML standards. Second, none of them are crystal clear on best
practices for I18N. There is a lot of *legal* (by the standard) syntax,
that makes no sense, or makes some sense without being clearly best. The
W3C site often states something to the effect of, "some are doing this,
some are doing that, on your own site, at least do something and only
time will tell what is best."

Check out these fine examples, which mirror my syntax, on the W3C site.

Internationali zation Best Practices: Specifying Language in XHTML & HTML
Content
http://www.w3.org/TR/i18n-html-tech-...0429.092928424
Tutorial: Declaring Language in XHTML and HTML (Draft)
http://www.w3.org/International/tuto...Slide0160.html

Juan, you wrote:
>>But, it seems to me that setting xml:lang for the html tag's *attribute*
values is unneeded, since they must
be in English, and they must be attributes set to a language identifier,
as defined by IETF RFC 4646
(http://www.ietf.org/rfc/rfc4646.txt).

You're not setting it for "the tag's *attribute*", you're setting it for
the *contents*, all contents, of the element (unless overridden by a
sub-setting), which makes perfect sense so that I don't have to set it
individually on every child element--that is the power of a hierarchy!
You seem to be focused on the technical, with some misunderstandin g,
versus the spirit of what we're trying to accomplish: telling user agents
who our intended audiences is, by language, as best we can...which is why
I'm *also* setting lang in the HTTP headers and in page meta tags.

, Lee
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:OY******* *******@TK2MSFT NGP02.phx.gbl.. .
>>re:
!I found an MSDN document that explains why what I'm trying to do
should work

Lee,

From :

http://www.w3.org/TR/REC-xml/

"A special attribute named xml:lang may be inserted in documents to
specify the
language used in the contents and attribute values of any element in an
XML document."

If anything, I can see xml:lang being declared for specific content
values, for example :

<p xml:lang="en-GB">What colour is it?</p>
<p xml:lang="en-US">What color is it?</p>

Then, an xml parser could identify regional US and British spellings
but, given that *all* the attribute values
must be in English in an html doc, what would be the purpose of
declaring xml:lang for the html markup ?

A similar explanation is given here :
http://www.simonstl.com/xmlprim/xmlupdate/atts.html

---000---
<SECTION>
<DESCRIPTIO N xml:lang="en">
Caesar begins by describing the geography of Gaul.
</DESCRIPTION>
<QUOTE xml:lang="la">
Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae,
aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli
appellantur .
</QUOTE>
---000---

That's perfectly good usage for xml:lang, as a parser could selectively
identify content in different languages.

But, it seems to me that setting xml:lang for the html tag's *attribute*
values is unneeded, since they must
be in English, and they must be attributes set to a language identifier,
as defined by IETF RFC 4646
(http://www.ietf.org/rfc/rfc4646.txt).

So, I think that requisite pretty well establishes the futility
of setting xml:lang for all the attributes in an html document.

If anything, it seems that the xml:lang attribute is included in the
html server tag for compatibility purposes, or perhaps out of ignorance.

If there's a need to identify that the *contents* of a particular markup
tag are in a
specific language, that identification can be included in the tag
itself, for example :

<div lang="MX-es" xml:lang="MX-es">
Algo de contenido en español mejicano.
</div>

That makes a lot more sense than setting xml:lang for the attribute
values in the html tag.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============= =============== ==========
"Lee C." <no*****@spamme r.comwrote in message
news:%2****** **********@TK2M SFTNGP04.phx.gb l...
I found an MSDN document that explains why what I'm trying to do should
work.

ASP.NET Web Server Controls Overview
http://msdn.microsoft.com/en-us/library/zsyt68f1.aspx

Note the distinction between HTML Server Controls and Web Server
Controls in the document. Also, note the explanation
of "pass-through" attributes for HTML Server Controls.

Two quotes that sum it up:
1. Any HTML element on a page can be converted to an HTML server
control by adding the attribute runat="server".
2. You can add any attributes you need to an HTML server control and
the page framework will render them without
any change in functionality.

, Lee

"Lee C." <no*****@spamme r.comwrote in message
news:Oe***** *********@TK2MS FTNGP03.phx.gbl ...
Juan,
>
I appreciate your trying to help, but you're wrong, and you are the
one who is confused. :]
>
I am *not* disputing that when inserted programmaticall y, the xml:lang
attribute renders to the browser. I did just
that as a work around (right after I discovered this bug); but, I
should not have to.
>
I am *not* confusing html attributes with runat="server" attributes,
as you call them. Using your logic, none of the
declarati ve (html) attributes should render to the browser after I add
the runat="server" in ASP.NET; yet all of them
(xmlns, lang, and dir) do--except xml:lang.
>
I started with an html element with 4 attributes (xmlns, lang,
xml:lang, and dir) all set declaratively. With *no*
5th attribute of runat="server", all 4 attributes render. If I add
the 5th attribute of runat="server", which does
not and should not render, I no longer get all 4 attributes that
should render (xmlns, lang, xml:lang, and dir), I
only get 3 (xmlns, lang, and dir). My logic says I should get 4, your
says I should get 3? It would be 4 or 0, and
4 is right. Not 0...and not 3.
>
When I add runat="server", it does not magically make the xml:lang
attribute a server-side attribute, while keeping
the other three attributes as "html" attributes. All four are still
"html" attributes--which should render.
>
I think the simplification of my example may be confusing you. It is
odd that, in my example, I set runat="server"
but do not have any server-side attributes. (I have all 4 as literal
strings, for simplicity of an example.) Well,
in my real-world use, I do have server-side attributes, which I want
set declaratively (no code-beside and no
script). I have:
>
<html runat="server" xmlns="http://www.w3.org/1999/xhtml"
xml:lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
dir="ltr">
>
Both of those declarative explicit localization expressions should
work without my having to write any more
"procedural " (code-beside) code or script. It actually does work fine
for the lang attribute--as it should; but not
for the xml:lang attribute--***which is a bug***.
>
, Lee
>
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:u0**** **********@TK2M SFTNGP04.phx.gb l...
>re:
>!I think you are misunderstandin g, Juan.
>>
>Well, I think you are misunderstandin g *me*.
>>
>re:
>!I had the xml:lang attribute in the html tag (declaratively) , like
>this:
>>...and it renders to the browser, as it should.
>>
>Yes, because it's standard html.
>>
>re:
>!If I simply add runat="server"
>>
>That declares the control to run server side.
>>
>For any attribute to be programmed server-side you need a script,
>just as you need a script to modify any server control's attributes.
>>
>Did you run the sample page I sent ?
>>
>It iterates throught the attributes for the html server control,
>and shows that the xml:lang attribute *is* added programmaticall y.
>>
>re:
>!If I simply add runat="server", leaving in the xml:lang attribute
>that
>!renders without runat="server", all of the (declarative)
>attribut es are
>!rendere d to the browser--except the xml:lang attribute! That is a
>bug.
>>
>I think you're confusing html attributes with runat="server"
>attributes .
>>
>Html attributes can be inserted in normal html.
>Server-side attributes must be inserted in code.
>>
>Maybe I'm not explaining this as well as I should.
>Try to get someone else's opinion on this matter, if you don't accept
>mine.
>>
>>
>>
>Juan T. Llibre, asp.net MVP
>asp.net faq : http://asp.net.do/faq/
>foros de asp.net, en español : http://asp.net.do/foros/
>========== =============== =============
>"Lee C." <no*****@spamme r.comwrote in message
>news:en*** ***********@TK2 MSFTNGP04.phx.g bl...
>>>I think you are misunderstandin g, Juan. I had the xml:lang attribute
>>>in the html tag (declaratively) , like this:
>>>
>><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"
>>lang="e n-US" dir="ltr">
>>>
>>...and it renders to the browser, as it should.
>>>
>>If I simply add runat="server", leaving in the xml:lang attribute
>>that renders without runat="server", all of the
>>(declarat ive) attributes are rendered to the browser--except the
>>xml:lan g attribute! That is a bug.
>>>
>><html runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>xml:lang= "en-US" lang="en-US" dir="ltr">
>>>
>>Cordially ,
>>Lee
>>>
>>>
>>"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
>>news:ey** ************@TK 2MSFTNGP02.phx. gbl...
>>>Here's a full example which shows that the xml:lang attribute is
>>>added programmaticall y :
>>>>
>>>attribut es.aspx:
>>>----------------------
>>><%@ Page Language="C#" AutoEventWireup ="True" %>
>>><html xmlns="http://www.w3.org/1999/xhtml" runat="server" id="Myid"
>>> >
>>><scrip t language="C#" runat="server">
>>>void Page_Load(Objec t sender, EventArgs e)
>>>{
>>>Myid.Att ributes.Add("xm l:lang", "es");
>>>Message. InnerHtml = "<h4>The html control attributes collection
>>>contains :</h4>";
>>>IEnumera tor keys = Myid.Attributes .Keys.GetEnumer ator();
>>>while (keys.MoveNext( ))
>>>{
>>>String key = (String)keys.Cu rrent;
>>>Message. InnerHtml += key + "=" + Myid.Attributes[key] + "<br />";
>>>}
>>>}
>>></script>
>>><head id="Head1" runat="server">
>>><title>T he html control attributes collection</title>
>>></head>
>>><body>
>>><form id="Form1" runat="server">
>>><h3>Html Control Attribute Collection Example</h3>
>>><br />
>>><span id="Message" enableviewstate ="false" runat="server" />
>>></form>
>>></body>
>>></html>
>>>----------------
>>>>
>>>I don't think it's a bug to have to add an attribute
>>>programm atically,
>>>becaus e the runat="server" tag only *declares* the html control as
>>>a programmable control.
>>>>
>>>To actually program it, you must use a script.
>>>>
>>>>
>>>>
>>>>
>>>Juan T. Llibre, asp.net MVP
>>>asp.ne t faq : http://asp.net.do/faq/
>>>foros de asp.net, en español : http://asp.net.do/foros/
>>>======== =============== ===============
>>>"Lee C." <no*****@spamme r.comwrote in message
>>>news:e0* *************@T K2MSFTNGP03.phx .gbl...
>>>>Thank s, Juan.
>>>>>
>>>>I already added similar code to a page event in my masterpage
>>>>code-beside.
>>>>>
>>>> elHtml.Attribut es.Add("xml:lan g",
>>>>Resourc es.GlobalLang.C ontentAudienceL anguage)
>>>>>
>>>>To me, that is a temporary workaround. I still want to understand
>>>>wheth er the "eating" of the attribute I
>>>>origina lly
>>>>poste d about is a bug, or if this is actually happening for a
>>>>reaso n.
>>>>>
>>>>Cordial ly,
>>>>Lee
>>>>>
>>>>>
>>>>"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
>>>>news:%2 *************** *@TK2MSFTNGP03. phx.gbl...
>>>>>Hi, Lee.
>>>>>>
>>>>>re:
>>>>>!<ht ml runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>>>>xml:la ng="en-US" lang="en-US" dir="ltr">
>>>>>!no xml:lang attribute is rendered to the browser!
>>>>>!Remov e the runat="server", and, voila, the xml:lang attribute
>>>>>is rendered.
>>>>>>
>>>>>Try this :
>>>>>>
>>>>><htm l xmlns="http://www.w3.org/1999/xhtml" runat="server"
>>>>>id="so meID">
>>>>>>
>>>>><scrip t runat="server">
>>>>>someID .Attributes("xm l:lang") = "en-US"
>>>>></script>
>>>>>>
>>>>>>
>>>>>>
>>>>>Juan T. Llibre, asp.net MVP
>>>>>asp.ne t faq : http://asp.net.do/faq/
>>>>>foro s de asp.net, en español : http://asp.net.do/foros/
>>>>>====== =============== =============== ==
>>>>>>
>>>>>"Lee C." <no****@spam.co mwrote in message
>>>>>news:O %************** **@TK2MSFTNGP03 .phx.gbl...
>>>>>>>I think I have discovered a bug in ASP.NET, related to I18N.
>>>>>>>
>>>>>>In ASP.NET 3.5 I have to set runat="server" on the html element
>>>>>>to use explicit expressions. It appears that
>>>>>>ASP.N ET
>>>>>>eat s the xml:lang attribute on the html element when it is set
>>>>>>to runat="server".
>>>>>>>
>>>>>>Of course I want to replace the hardcoded "en-US" values with
>>>>>>(reso urce) explicit expressions; but, for
>>>>>>simpl icity,
>>>>>>try this:
>>>>>>>
>>>>>><ht ml runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>>>>>xml:l ang="en-US" lang="en-US" dir="ltr">
>>>>>>>
>>>>>>...An d you will find that no xml:lang attribute is rendered to
>>>>>>the browser! Remove the runat="server", and,
>>>>>>voila ,
>>>>>>the
>>>>>>xml:l ang attribute is rendered. :[
>>>>>>>
>>>>>>...An y ideas?
>>>>>>>
>>>>>>Cordi ally,
>>>>>>Lee
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>




Jun 28 '08 #4
re:
!ASP.NET should make it easy for me--and, it does,
!but there is a bug in the implementation.

The fact that you *can* set xml:lang programmaticall y, and that you *did* set it that way,
as I did, should tell you that it isn't much of a bug, but a question of using the correct implementation.

But, again, please let us know what the reply to your bug report is.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Lee C." <no****@spam.co mwrote in message news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Juan,

My use of language and culture in ASP.Net is a bit different than most. I have registered numerous
country-code-specific domains (mysite.ca, mysite.co.uk, mysite.com.au, etc.), which resolve to a singular "ASP.Net Web
Site". Nothing new there. However, I'm not doing the ASP.Net usual of letting the user agent (HTTP header
'accept-language') determine which language visitors get; I have the country-code TLD drive it. Also, it's not just
the language of my content that varies by cc TLD, it's the content, too; but, lang attributes play a critical role in
informing user agents (including search engine bots) for what "country" my content is aimed.

I have already found, first-hand, that the better of the major search engines use the cc TLD *and* the HTML
lang/xml:lang to determine whether a domain's documents (mysite.com.au/my-document.aspx) should show up when a
searcher searches with the 'Only from Australia' checkbox checked on Live.com, for example.

I'm not setting lang attributes for fun; I'm doing it to correct search engine results. ASP.NET should make it easy
for me--and, it does, but there is a bug in the implementation.

I appreciate your interest and effort to help.

, Lee
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:uB******** ******@TK2MSFTN GP03.phx.gbl...
>re:
!versus the spirit of what we're trying to accomplish: telling user agents who our
!intended audiences is, by language, as best we can...which is why I'm *also*
!setting lang in the HTTP headers and in page meta tags

What ? You don't set a language/culture in web.config, too ?
There's a use for overkill ! ( only kidding... )

I don't see too clearly the purpose of declaring a single language for a web page.

I do see a use for declaring specific language attributes in a *collection* of xml documents,
so that individual documents can be parsed for a particular language content.

But, ymmv...

I'd still be interested in knowing what the reply is to your bug report.
I bet you'll get back : "That's by design". <g>

Don't forget to let us all know what happens with that, OK ?
Thanks for an interesting discussion.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============== =============== =========
"Lee C." <no****@spam.co mwrote in message news:en******** *****@TK2MSFTNG P05.phx.gbl...
>>Juan,

In theory, I like your idea of investigating "the standard"; but, in practice it has serious problems, as it often
does. First, you are referring to the XML standard, which is not as appropriate as HTML and XHTML standards.
Second, none of them are crystal clear on best practices for I18N. There is a lot of *legal* (by the standard)
syntax, that makes no sense, or makes some sense without being clearly best. The W3C site often states something to
the effect of, "some are doing this, some are doing that, on your own site, at least do something and only time will
tell what is best."

Check out these fine examples, which mirror my syntax, on the W3C site.

International ization Best Practices: Specifying Language in XHTML & HTML Content
http://www.w3.org/TR/i18n-html-tech-...0429.092928424
Tutorial: Declaring Language in XHTML and HTML (Draft)
http://www.w3.org/International/tuto...Slide0160.html

Juan, you wrote:
But, it seems to me that setting xml:lang for the html tag's *attribute* values is unneeded, since they must
be in English, and they must be attributes set to a language identifier, as defined by IETF RFC 4646
(http://www.ietf.org/rfc/rfc4646.txt).

You're not setting it for "the tag's *attribute*", you're setting it for the *contents*, all contents, of the
element (unless overridden by a sub-setting), which makes perfect sense so that I don't have to set it individually
on every child element--that is the power of a hierarchy! You seem to be focused on the technical, with some
misunderstand ing, versus the spirit of what we're trying to accomplish: telling user agents who our intended
audiences is, by language, as best we can...which is why I'm *also* setting lang in the HTTP headers and in page
meta tags.

, Lee
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:OY******** ******@TK2MSFTN GP02.phx.gbl...
re:
!I found an MSDN document that explains why what I'm trying to do should work

Lee,

From :

http://www.w3.org/TR/REC-xml/

"A special attribute named xml:lang may be inserted in documents to specify the
language used in the contents and attribute values of any element in an XML document."

If anything, I can see xml:lang being declared for specific content values, for example :

<p xml:lang="en-GB">What colour is it?</p>
<p xml:lang="en-US">What color is it?</p>

Then, an xml parser could identify regional US and British spellings but, given that *all* the attribute values
must be in English in an html doc, what would be the purpose of declaring xml:lang for the html markup ?

A similar explanation is given here :
http://www.simonstl.com/xmlprim/xmlupdate/atts.html

---000---
<SECTION>
<DESCRIPTI ON xml:lang="en">
Caesar begins by describing the geography of Gaul.
</DESCRIPTION>
<QUOTE xml:lang="la">
Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae,
aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli appellantur.
</QUOTE>
---000---

That's perfectly good usage for xml:lang, as a parser could selectively identify content in different languages.

But, it seems to me that setting xml:lang for the html tag's *attribute* values is unneeded, since they must
be in English, and they must be attributes set to a language identifier, as defined by IETF RFC 4646
(http://www.ietf.org/rfc/rfc4646.txt).

So, I think that requisite pretty well establishes the futility
of setting xml:lang for all the attributes in an html document.

If anything, it seems that the xml:lang attribute is included in the
html server tag for compatibility purposes, or perhaps out of ignorance.

If there's a need to identify that the *contents* of a particular markup tag are in a
specific language, that identification can be included in the tag itself, for example :

<div lang="MX-es" xml:lang="MX-es">
Algo de contenido en español mejicano.
</div>

That makes a lot more sense than setting xml:lang for the attribute values in the html tag.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============ =============== ===========
"Lee C." <no*****@spamme r.comwrote in message news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>I found an MSDN document that explains why what I'm trying to do should work.
>
ASP.NET Web Server Controls Overview
http://msdn.microsoft.com/en-us/library/zsyt68f1.aspx
>
Note the distinction between HTML Server Controls and Web Server Controls in the document. Also, note the
explanati on
of "pass-through" attributes for HTML Server Controls.
>
Two quotes that sum it up:
1. Any HTML element on a page can be converted to an HTML server control by adding the attribute
runat="serv er".
2. You can add any attributes you need to an HTML server control and the page framework will render them
without
any change in functionality.
>
, Lee
>
"Lee C." <no*****@spamme r.comwrote in message news:Oe******** ******@TK2MSFTN GP03.phx.gbl...
>Juan,
>>
>I appreciate your trying to help, but you're wrong, and you are the one who is confused. :]
>>
>I am *not* disputing that when inserted programmaticall y, the xml:lang attribute renders to the browser. I did
>just
>that as a work around (right after I discovered this bug); but, I should not have to.
>>
>I am *not* confusing html attributes with runat="server" attributes, as you call them. Using your logic, none of
>the
>declarativ e (html) attributes should render to the browser after I add the runat="server" in ASP.NET; yet all of
>them
>(xmlns, lang, and dir) do--except xml:lang.
>>
>I started with an html element with 4 attributes (xmlns, lang, xml:lang, and dir) all set declaratively. With
>*no*
>5th attribute of runat="server", all 4 attributes render. If I add the 5th attribute of runat="server", which
>does
>not and should not render, I no longer get all 4 attributes that should render (xmlns, lang, xml:lang, and dir),
>I
>only get 3 (xmlns, lang, and dir). My logic says I should get 4, your says I should get 3? It would be 4 or 0,
>and
>4 is right. Not 0...and not 3.
>>
>When I add runat="server", it does not magically make the xml:lang attribute a server-side attribute, while
>keeping
>the other three attributes as "html" attributes. All four are still "html" attributes--which should render.
>>
>I think the simplification of my example may be confusing you. It is odd that, in my example, I set
>runat="ser ver"
>but do not have any server-side attributes. (I have all 4 as literal strings, for simplicity of an example.)
>Well,
>in my real-world use, I do have server-side attributes, which I want set declaratively (no code-beside and no
>script). I have:
>>
><html runat="server" xmlns="http://www.w3.org/1999/xhtml"
> xml:lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
> lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
> dir="ltr">
>>
>Both of those declarative explicit localization expressions should work without my having to write any more
>"procedura l" (code-beside) code or script. It actually does work fine for the lang attribute--as it should; but
>not
>for the xml:lang attribute--***which is a bug***.
>>
>, Lee
>>
>"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:u0******** ******@TK2MSFTN GP04.phx.gbl...
>>re:
>>!I think you are misunderstandin g, Juan.
>>>
>>Well, I think you are misunderstandin g *me*.
>>>
>>re:
>>!I had the xml:lang attribute in the html tag (declaratively) , like this:
>>>...and it renders to the browser, as it should.
>>>
>>Yes, because it's standard html.
>>>
>>re:
>>!If I simply add runat="server"
>>>
>>That declares the control to run server side.
>>>
>>For any attribute to be programmed server-side you need a script,
>>just as you need a script to modify any server control's attributes.
>>>
>>Did you run the sample page I sent ?
>>>
>>It iterates throught the attributes for the html server control,
>>and shows that the xml:lang attribute *is* added programmaticall y.
>>>
>>re:
>>!If I simply add runat="server", leaving in the xml:lang attribute that
>>!render s without runat="server", all of the (declarative) attributes are
>>!render ed to the browser--except the xml:lang attribute! That is a bug.
>>>
>>I think you're confusing html attributes with runat="server" attributes.
>>>
>>Html attributes can be inserted in normal html.
>>Server-side attributes must be inserted in code.
>>>
>>Maybe I'm not explaining this as well as I should.
>>Try to get someone else's opinion on this matter, if you don't accept mine.
>>>
>>>
>>>
>>Juan T. Llibre, asp.net MVP
>>asp.net faq : http://asp.net.do/faq/
>>foros de asp.net, en español : http://asp.net.do/foros/
>>========= =============== ==============
>>"Lee C." <no*****@spamme r.comwrote in message news:en******** ******@TK2MSFTN GP04.phx.gbl...
>>>>I think you are misunderstandin g, Juan. I had the xml:lang attribute in the html tag (declaratively) , like
>>>>this:
>>>>
>>><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>
>>>...and it renders to the browser, as it should.
>>>>
>>>If I simply add runat="server", leaving in the xml:lang attribute that renders without runat="server", all of
>>>the
>>>(declara tive) attributes are rendered to the browser--except the xml:lang attribute! That is a bug.
>>>>
>>><html runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>
>>>Cordiall y,
>>>Lee
>>>>
>>>>
>>>"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:ey******** ******@TK2MSFTN GP02.phx.gbl...
>>>>Here' s a full example which shows that the xml:lang attribute is added programmaticall y :
>>>>>
>>>>attribu tes.aspx:
>>>>----------------------
>>>><%@ Page Language="C#" AutoEventWireup ="True" %>
>>>><html xmlns="http://www.w3.org/1999/xhtml" runat="server" id="Myid" >
>>>><scri pt language="C#" runat="server">
>>>>void Page_Load(Objec t sender, EventArgs e)
>>>>{
>>>>Myid.At tributes.Add("x ml:lang", "es");
>>>>Message .InnerHtml = "<h4>The html control attributes collection contains:</h4>";
>>>>IEnumer ator keys = Myid.Attributes .Keys.GetEnumer ator();
>>>>while (keys.MoveNext( ))
>>>>{
>>>>Strin g key = (String)keys.Cu rrent;
>>>>Message .InnerHtml += key + "=" + Myid.Attributes[key] + "<br />";
>>>>}
>>>>}
>>>></script>
>>>><head id="Head1" runat="server">
>>>><title> The html control attributes collection</title>
>>>></head>
>>>><body >
>>>><form id="Form1" runat="server">
>>>><h3>Htm lControl Attribute Collection Example</h3>
>>>><br />
>>>><span id="Message" enableviewstate ="false" runat="server" />
>>>></form>
>>>></body>
>>>></html>
>>>>----------------
>>>>>
>>>>I don't think it's a bug to have to add an attribute programmaticall y,
>>>>becau se the runat="server" tag only *declares* the html control as a programmable control.
>>>>>
>>>>To actually program it, you must use a script.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>Juan T. Llibre, asp.net MVP
>>>>asp.n et faq : http://asp.net.do/faq/
>>>>foros de asp.net, en español : http://asp.net.do/foros/
>>>>======= =============== =============== =
>>>>"Lee C." <no*****@spamme r.comwrote in message news:e0******** ******@TK2MSFTN GP03.phx.gbl...
>>>>>Thanks , Juan.
>>>>>>
>>>>>I already added similar code to a page event in my masterpage code-beside.
>>>>>>
>>>>> elHtml.Attribut es.Add("xml:lan g", Resources.Globa lLang.ContentAu dienceLanguage)
>>>>>>
>>>>>To me, that is a temporary workaround. I still want to understand whether the "eating" of the attribute I
>>>>>origin ally
>>>>>post ed about is a bug, or if this is actually happening for a reason.
>>>>>>
>>>>>Cordia lly,
>>>>>Lee
>>>>>>
>>>>>>
>>>>>"Jua n T. Llibre" <no***********@ nowhere.comwrot e in message news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>>>>>>Hi, Lee.
>>>>>>>
>>>>>>re:
>>>>>>!<htm l runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>!no xml:lang attribute is rendered to the browser!
>>>>>>!Remo ve the runat="server", and, voila, the xml:lang attribute is rendered.
>>>>>>>
>>>>>>Try this :
>>>>>>>
>>>>>><ht ml xmlns="http://www.w3.org/1999/xhtml" runat="server" id="someID">
>>>>>>>
>>>>>><scri pt runat="server">
>>>>>>someI D.Attributes("x ml:lang") = "en-US"
>>>>>></script>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>Jua n T. Llibre, asp.net MVP
>>>>>>asp.n et faq : http://asp.net.do/faq/
>>>>>>for os de asp.net, en español : http://asp.net.do/foros/
>>>>>>===== =============== =============== ===
>>>>>>>
>>>>>>"Le e C." <no****@spam.co mwrote in message news:O%******** ********@TK2MSF TNGP03.phx.gbl. ..
>>>>>>>>I think I have discovered a bug in ASP.NET, related to I18N.
>>>>>>>>
>>>>>>>In ASP.NET 3.5 I have to set runat="server" on the html element to use explicit expressions. It appears
>>>>>>>th at
>>>>>>>ASP. NET
>>>>>>>ea ts the xml:lang attribute on the html element when it is set to runat="server".
>>>>>>>>
>>>>>>>Of course I want to replace the hardcoded "en-US" values with (resource) explicit expressions; but, for
>>>>>>>simp licity,
>>>>>>>tr y this:
>>>>>>>>
>>>>>>><htm l runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>>>
>>>>>>>...A nd you will find that no xml:lang attribute is rendered to the browser! Remove the runat="server", and,
>>>>>>>voil a,
>>>>>>>th e
>>>>>>>xml: lang attribute is rendered. :[
>>>>>>>>
>>>>>>>...A ny ideas?
>>>>>>>>
>>>>>>>Cord ially,
>>>>>>>Le e
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>




Jun 28 '08 #5
Correct implementation? What do you mean by that?

I stated earlier on that I worked around it. It's still a bug. Setting it
programmaticall y is an incorrect implementation when everything else on my
page is set declaratively. Microsoft offered declarative (explicit)
expressions, and I want to use them--anywhere and everywhere I choose in
accordance with how they are stated to work. When I find one that doesn't
work, it's a bug; it's not a case of my doing something incorrectly. I love
Microsoft Visual Studio 2008; but, I won't tolerate bugs, or suck them up
as, "Oh, I must be doing it wrong since it doesn't work--even though it
should."

, Lee

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
re:
!ASP.NET should make it easy for me--and, it does,
!but there is a bug in the implementation.

The fact that you *can* set xml:lang programmaticall y, and that you *did*
set it that way,
as I did, should tell you that it isn't much of a bug, but a question of
using the correct implementation.

But, again, please let us know what the reply to your bug report is.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Lee C." <no****@spam.co mwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>Juan,

My use of language and culture in ASP.Net is a bit different than most.
I have registered numerous country-code-specific domains (mysite.ca,
mysite.co.uk , mysite.com.au, etc.), which resolve to a singular "ASP.Net
Web Site". Nothing new there. However, I'm not doing the ASP.Net usual
of letting the user agent (HTTP header 'accept-language') determine which
language visitors get; I have the country-code TLD drive it. Also, it's
not just the language of my content that varies by cc TLD, it's the
content, too; but, lang attributes play a critical role in informing user
agents (including search engine bots) for what "country" my content is
aimed.

I have already found, first-hand, that the better of the major search
engines use the cc TLD *and* the HTML lang/xml:lang to determine whether
a domain's documents (mysite.com.au/my-document.aspx) should show up when
a searcher searches with the 'Only from Australia' checkbox checked on
Live.com, for example.

I'm not setting lang attributes for fun; I'm doing it to correct search
engine results. ASP.NET should make it easy for me--and, it does, but
there is a bug in the implementation.

I appreciate your interest and effort to help.

, Lee
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:uB******* *******@TK2MSFT NGP03.phx.gbl.. .
>>re:
!versus the spirit of what we're trying to accomplish: telling user
agents who our
!intended audiences is, by language, as best we can...which is why I'm
*also*
!setting lang in the HTTP headers and in page meta tags

What ? You don't set a language/culture in web.config, too ?
There's a use for overkill ! ( only kidding... )

I don't see too clearly the purpose of declaring a single language for a
web page.

I do see a use for declaring specific language attributes in a
*collection * of xml documents,
so that individual documents can be parsed for a particular language
content.

But, ymmv...

I'd still be interested in knowing what the reply is to your bug report.
I bet you'll get back : "That's by design". <g>

Don't forget to let us all know what happens with that, OK ?
Thanks for an interesting discussion.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============= =============== ==========
"Lee C." <no****@spam.co mwrote in message
news:en****** *******@TK2MSFT NGP05.phx.gbl.. .
Juan,

In theory, I like your idea of investigating "the standard"; but, in
practice it has serious problems, as it often does. First, you are
referring to the XML standard, which is not as appropriate as HTML and
XHTML standards. Second, none of them are crystal clear on best
practices for I18N. There is a lot of *legal* (by the standard)
syntax, that makes no sense, or makes some sense without being clearly
best. The W3C site often states something to the effect of, "some are
doing this, some are doing that, on your own site, at least do
something and only time will tell what is best."

Check out these fine examples, which mirror my syntax, on the W3C site.

Internationa lization Best Practices: Specifying Language in XHTML &
HTML Content
http://www.w3.org/TR/i18n-html-tech-...0429.092928424
Tutorial: Declaring Language in XHTML and HTML (Draft)
http://www.w3.org/International/tuto...Slide0160.html

Juan, you wrote:
But, it seems to me that setting xml:lang for the html tag's
*attribut e* values is unneeded, since they must
be in English, and they must be attributes set to a language
identifie r, as defined by IETF RFC 4646
(http://www.ietf.org/rfc/rfc4646.txt).

You're not setting it for "the tag's *attribute*", you're setting it
for the *contents*, all contents, of the element (unless overridden by
a sub-setting), which makes perfect sense so that I don't have to set
it individually on every child element--that is the power of a
hierarchy! You seem to be focused on the technical, with some
misunderstan ding, versus the spirit of what we're trying to accomplish:
telling user agents who our intended audiences is, by language, as best
we can...which is why I'm *also* setting lang in the HTTP headers and
in page meta tags.

, Lee
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:OY***** *********@TK2MS FTNGP02.phx.gbl ...
re:
!I found an MSDN document that explains why what I'm trying to do
should work
>
Lee,
>
From :
>
http://www.w3.org/TR/REC-xml/
>
"A special attribute named xml:lang may be inserted in documents to
specify the
language used in the contents and attribute values of any element in
an XML document."
>
If anything, I can see xml:lang being declared for specific content
values, for example :
>
<p xml:lang="en-GB">What colour is it?</p>
<p xml:lang="en-US">What color is it?</p>
>
Then, an xml parser could identify regional US and British spellings
but, given that *all* the attribute values
must be in English in an html doc, what would be the purpose of
declaring xml:lang for the html markup ?
>
A similar explanation is given here :
http://www.simonstl.com/xmlprim/xmlupdate/atts.html
>
---000---
<SECTION>
<DESCRIPTIO N xml:lang="en">
Caesar begins by describing the geography of Gaul.
</DESCRIPTION>
<QUOTE xml:lang="la">
Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae,
aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli
appellantur .
</QUOTE>
---000---
>
That's perfectly good usage for xml:lang, as a parser could
selective ly identify content in different languages.
>
But, it seems to me that setting xml:lang for the html tag's
*attribut e* values is unneeded, since they must
be in English, and they must be attributes set to a language
identifie r, as defined by IETF RFC 4646
(http://www.ietf.org/rfc/rfc4646.txt).
>
So, I think that requisite pretty well establishes the futility
of setting xml:lang for all the attributes in an html document.
>
If anything, it seems that the xml:lang attribute is included in the
html server tag for compatibility purposes, or perhaps out of
ignorance .
>
If there's a need to identify that the *contents* of a particular
markup tag are in a
specific language, that identification can be included in the tag
itself, for example :
>
<div lang="MX-es" xml:lang="MX-es">
Algo de contenido en español mejicano.
</div>
>
That makes a lot more sense than setting xml:lang for the attribute
values in the html tag.
>
>
>
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=========== =============== ============
"Lee C." <no*****@spamme r.comwrote in message
news:%2**** ************@TK 2MSFTNGP04.phx. gbl...
>>I found an MSDN document that explains why what I'm trying to do
>>should work.
>>
>ASP.NET Web Server Controls Overview
>http://msdn.microsoft.com/en-us/library/zsyt68f1.aspx
>>
>Note the distinction between HTML Server Controls and Web Server
>Controls in the document. Also, note the explanation
>of "pass-through" attributes for HTML Server Controls.
>>
>Two quotes that sum it up:
> 1. Any HTML element on a page can be converted to an HTML server
>control by adding the attribute runat="server".
> 2. You can add any attributes you need to an HTML server control
>and the page framework will render them without
>any change in functionality.
>>
>, Lee
>>
>"Lee C." <no*****@spamme r.comwrote in message
>news:Oe*** ***********@TK2 MSFTNGP03.phx.g bl...
>>Juan,
>>>
>>I appreciate your trying to help, but you're wrong, and you are the
>>one who is confused. :]
>>>
>>I am *not* disputing that when inserted programmaticall y, the
>>xml:lan g attribute renders to the browser. I did just
>>that as a work around (right after I discovered this bug); but, I
>>should not have to.
>>>
>>I am *not* confusing html attributes with runat="server" attributes,
>>as you call them. Using your logic, none of the
>>declarati ve (html) attributes should render to the browser after I
>>add the runat="server" in ASP.NET; yet all of them
>>(xmlns, lang, and dir) do--except xml:lang.
>>>
>>I started with an html element with 4 attributes (xmlns, lang,
>>xml:lan g, and dir) all set declaratively. With *no*
>>5th attribute of runat="server", all 4 attributes render. If I add
>>the 5th attribute of runat="server", which does
>>not and should not render, I no longer get all 4 attributes that
>>should render (xmlns, lang, xml:lang, and dir), I
>>only get 3 (xmlns, lang, and dir). My logic says I should get 4,
>>your says I should get 3? It would be 4 or 0, and
>>4 is right. Not 0...and not 3.
>>>
>>When I add runat="server", it does not magically make the xml:lang
>>attribu te a server-side attribute, while keeping
>>the other three attributes as "html" attributes. All four are still
>>"html" attributes--which should render.
>>>
>>I think the simplification of my example may be confusing you. It
>>is odd that, in my example, I set runat="server"
>>but do not have any server-side attributes. (I have all 4 as
>>literal strings, for simplicity of an example.) Well,
>>in my real-world use, I do have server-side attributes, which I want
>>set declaratively (no code-beside and no
>>script) . I have:
>>>
>><html runat="server" xmlns="http://www.w3.org/1999/xhtml"
>> xml:lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
>> lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
>> dir="ltr">
>>>
>>Both of those declarative explicit localization expressions should
>>work without my having to write any more
>>"procedur al" (code-beside) code or script. It actually does work
>>fine for the lang attribute--as it should; but not
>>for the xml:lang attribute--***which is a bug***.
>>>
>>, Lee
>>>
>>"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
>>news:u0** ************@TK 2MSFTNGP04.phx. gbl...
>>>re:
>>>!I think you are misunderstandin g, Juan.
>>>>
>>>Well, I think you are misunderstandin g *me*.
>>>>
>>>re:
>>>!I had the xml:lang attribute in the html tag (declaratively) ,
>>>like this:
>>>>...an d it renders to the browser, as it should.
>>>>
>>>Yes, because it's standard html.
>>>>
>>>re:
>>>!If I simply add runat="server"
>>>>
>>>That declares the control to run server side.
>>>>
>>>For any attribute to be programmed server-side you need a script,
>>>just as you need a script to modify any server control's
>>>attribut es.
>>>>
>>>Did you run the sample page I sent ?
>>>>
>>>It iterates throught the attributes for the html server control,
>>>and shows that the xml:lang attribute *is* added programmaticall y.
>>>>
>>>re:
>>>!If I simply add runat="server", leaving in the xml:lang
>>>attribut e that
>>>!rende rs without runat="server", all of the (declarative)
>>>attribut es are
>>>!rendere d to the browser--except the xml:lang attribute! That is
>>>a bug.
>>>>
>>>I think you're confusing html attributes with runat="server"
>>>attribut es.
>>>>
>>>Html attributes can be inserted in normal html.
>>>Server-side attributes must be inserted in code.
>>>>
>>>Maybe I'm not explaining this as well as I should.
>>>Try to get someone else's opinion on this matter, if you don't
>>>accept mine.
>>>>
>>>>
>>>>
>>>Juan T. Llibre, asp.net MVP
>>>asp.ne t faq : http://asp.net.do/faq/
>>>foros de asp.net, en español : http://asp.net.do/foros/
>>>======== =============== ===============
>>>"Lee C." <no*****@spamme r.comwrote in message
>>>news:en* *************@T K2MSFTNGP04.phx .gbl...
>>>>>I think you are misunderstandin g, Juan. I had the xml:lang
>>>>>attrib ute in the html tag (declaratively) , like this:
>>>>>
>>>><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"
>>>>lang="e n-US" dir="ltr">
>>>>>
>>>>...an d it renders to the browser, as it should.
>>>>>
>>>>If I simply add runat="server", leaving in the xml:lang attribute
>>>>that renders without runat="server", all of the
>>>>(declar ative) attributes are rendered to the browser--except the
>>>>xml:lan g attribute! That is a bug.
>>>>>
>>>><html runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>>>xml:lan g="en-US" lang="en-US" dir="ltr">
>>>>>
>>>>Cordial ly,
>>>>Lee
>>>>>
>>>>>
>>>>"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
>>>>news:ey **************@ TK2MSFTNGP02.ph x.gbl...
>>>>>Here 's a full example which shows that the xml:lang attribute is
>>>>>adde d programmaticall y :
>>>>>>
>>>>>attrib utes.aspx:
>>>>>----------------------
>>>>><%@ Page Language="C#" AutoEventWireup ="True" %>
>>>>><htm l xmlns="http://www.w3.org/1999/xhtml" runat="server"
>>>>>id="My id" >
>>>>><scrip t language="C#" runat="server">
>>>>>void Page_Load(Objec t sender, EventArgs e)
>>>>>{
>>>>>Myid.A ttributes.Add(" xml:lang", "es");
>>>>>Messag e.InnerHtml = "<h4>The html control attributes collection
>>>>>contai ns:</h4>";
>>>>>IEnume rator keys = Myid.Attributes .Keys.GetEnumer ator();
>>>>>whil e (keys.MoveNext( ))
>>>>>{
>>>>>Stri ng key = (String)keys.Cu rrent;
>>>>>Messag e.InnerHtml += key + "=" + Myid.Attributes[key] + "<br />";
>>>>>}
>>>>>}
>>>>></script>
>>>>><hea d id="Head1" runat="server">
>>>>><title >The html control attributes collection</title>
>>>>></head>
>>>>><bod y>
>>>>><for m id="Form1" runat="server">
>>>>><h3>Ht mlControl Attribute Collection Example</h3>
>>>>><br />
>>>>><spa n id="Message" enableviewstate ="false" runat="server" />
>>>>></form>
>>>>></body>
>>>>></html>
>>>>>----------------
>>>>>>
>>>>>I don't think it's a bug to have to add an attribute
>>>>>progra mmatically,
>>>>>becaus e the runat="server" tag only *declares* the html control
>>>>>as a programmable control.
>>>>>>
>>>>>To actually program it, you must use a script.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>Juan T. Llibre, asp.net MVP
>>>>>asp.ne t faq : http://asp.net.do/faq/
>>>>>foro s de asp.net, en español : http://asp.net.do/foros/
>>>>>====== =============== =============== ==
>>>>>"Lee C." <no*****@spamme r.comwrote in message
>>>>>news:e 0************** @TK2MSFTNGP03.p hx.gbl...
>>>>>>Thank s, Juan.
>>>>>>>
>>>>>>I already added similar code to a page event in my masterpage
>>>>>>cod e-beside.
>>>>>>>
>>>>>> elHtml.Attribut es.Add("xml:lan g",
>>>>>>Resou rces.GlobalLang .ContentAudienc eLanguage)
>>>>>>>
>>>>>>To me, that is a temporary workaround. I still want to
>>>>>>under stand whether the "eating" of the attribute I
>>>>>>origi nally
>>>>>>poste d about is a bug, or if this is actually happening for a
>>>>>>reaso n.
>>>>>>>
>>>>>>Cordi ally,
>>>>>>Lee
>>>>>>>
>>>>>>>
>>>>>>"Ju an T. Llibre" <no***********@ nowhere.comwrot e in message
>>>>>>news: %2************* ***@TK2MSFTNGP0 3.phx.gbl...
>>>>>>>Hi , Lee.
>>>>>>>>
>>>>>>>re :
>>>>>>>!<ht ml runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>>>>>>xml: lang="en-US" lang="en-US" dir="ltr">
>>>>>>>!n o xml:lang attribute is rendered to the browser!
>>>>>>>!Rem ove the runat="server", and, voila, the xml:lang
>>>>>>>attr ibute is rendered.
>>>>>>>>
>>>>>>>Tr y this :
>>>>>>>>
>>>>>>><htm l xmlns="http://www.w3.org/1999/xhtml" runat="server"
>>>>>>>id=" someID">
>>>>>>>>
>>>>>>><scr ipt runat="server">
>>>>>>>some ID.Attributes(" xml:lang") = "en-US"
>>>>>>></script>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>Ju an T. Llibre, asp.net MVP
>>>>>>>asp. net faq : http://asp.net.do/faq/
>>>>>>>foro s de asp.net, en español : http://asp.net.do/foros/
>>>>>>>==== =============== =============== ====
>>>>>>>>
>>>>>>>"L ee C." <no****@spam.co mwrote in message
>>>>>>>news :O%************ ****@TK2MSFTNGP 03.phx.gbl...
>>>>>>>>> I think I have discovered a bug in ASP.NET, related to I18N.
>>>>>>>>>
>>>>>>>>I n ASP.NET 3.5 I have to set runat="server" on the html
>>>>>>>>ele ment to use explicit expressions. It appears that
>>>>>>>>ASP .NET
>>>>>>>>eat s the xml:lang attribute on the html element when it is set
>>>>>>>>t o runat="server".
>>>>>>>>>
>>>>>>>>O f course I want to replace the hardcoded "en-US" values with
>>>>>>>>(re source) explicit expressions; but, for
>>>>>>>>sim plicity,
>>>>>>>>t ry this:
>>>>>>>>>
>>>>>>>><ht ml runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>>>>>>>xml :lang="en-US" lang="en-US" dir="ltr">
>>>>>>>>>
>>>>>>>>... And you will find that no xml:lang attribute is rendered to
>>>>>>>>t he browser! Remove the runat="server", and,
>>>>>>>>voi la,
>>>>>>>>t he
>>>>>>>>xml :lang attribute is rendered. :[
>>>>>>>>>
>>>>>>>>... Any ideas?
>>>>>>>>>
>>>>>>>>Cor dially,
>>>>>>>>L ee
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
>
>




Jun 28 '08 #6
re:
!Setting it programmaticall y is an incorrect implementation
!when everything else on my page is set declaratively.

Is everything else on your pages set declaratively ?
Think about that for a second.

Why do we have inline scripts and code-behind, if "everything else is set declaratively" ?

In any case, we've certainly had enough of the "I think that..." back and forth.

Let's pause this discussion until the "bug" you reported is explained by the VS Dev team, OK ?
I, definitely, want to see what their explanation is.

https://connect.microsoft.com/Visual...dbackID=353879

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Lee C." <no****@spam.co mwrote in message news:eQ******** ******@TK2MSFTN GP05.phx.gbl...
Correct implementation? What do you mean by that?

I stated earlier on that I worked around it. It's still a bug. Setting it programmaticall y is an incorrect
implementation when everything else on my page is set declaratively. Microsoft offered declarative (explicit)
expressions, and I want to use them--anywhere and everywhere I choose in accordance with how they are stated to work.
When I find one that doesn't work, it's a bug; it's not a case of my doing something incorrectly. I love Microsoft
Visual Studio 2008; but, I won't tolerate bugs, or suck them up as, "Oh, I must be doing it wrong since it doesn't
work--even though it should."

, Lee

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>re:
!ASP.NET should make it easy for me--and, it does,
!but there is a bug in the implementation.

The fact that you *can* set xml:lang programmaticall y, and that you *did* set it that way,
as I did, should tell you that it isn't much of a bug, but a question of using the correct implementation.

But, again, please let us know what the reply to your bug report is.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============== =============== =========
"Lee C." <no****@spam.co mwrote in message news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>>Juan,

My use of language and culture in ASP.Net is a bit different than most. I have registered numerous
country-code-specific domains (mysite.ca, mysite.co.uk, mysite.com.au, etc.), which resolve to a singular "ASP.Net
Web Site". Nothing new there. However, I'm not doing the ASP.Net usual of letting the user agent (HTTP header
'accept-language') determine which language visitors get; I have the country-code TLD drive it. Also, it's not just
the language of my content that varies by cc TLD, it's the content, too; but, lang attributes play a critical role
in informing user agents (including search engine bots) for what "country" my content is aimed.

I have already found, first-hand, that the better of the major search engines use the cc TLD *and* the HTML
lang/xml:lang to determine whether a domain's documents (mysite.com.au/my-document.aspx) should show up when a
searcher searches with the 'Only from Australia' checkbox checked on Live.com, for example.

I'm not setting lang attributes for fun; I'm doing it to correct search engine results. ASP.NET should make it easy
for me--and, it does, but there is a bug in the implementation.

I appreciate your interest and effort to help.

, Lee
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:uB******** ******@TK2MSFTN GP03.phx.gbl...
re:
!versus the spirit of what we're trying to accomplish: telling user agents who our
!intended audiences is, by language, as best we can...which is why I'm *also*
!setting lang in the HTTP headers and in page meta tags

What ? You don't set a language/culture in web.config, too ?
There's a use for overkill ! ( only kidding... )

I don't see too clearly the purpose of declaring a single language for a web page.

I do see a use for declaring specific language attributes in a *collection* of xml documents,
so that individual documents can be parsed for a particular language content.

But, ymmv...

I'd still be interested in knowing what the reply is to your bug report.
I bet you'll get back : "That's by design". <g>

Don't forget to let us all know what happens with that, OK ?
Thanks for an interesting discussion.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============ =============== ===========
"Lee C." <no****@spam.co mwrote in message news:en******** *****@TK2MSFTNG P05.phx.gbl...
Juan,
>
In theory, I like your idea of investigating "the standard"; but, in practice it has serious problems, as it often
does. First, you are referring to the XML standard, which is not as appropriate as HTML and XHTML standards.
Second, none of them are crystal clear on best practices for I18N. There is a lot of *legal* (by the standard)
syntax, that makes no sense, or makes some sense without being clearly best. The W3C site often states something
to the effect of, "some are doing this, some are doing that, on your own site, at least do something and only time
will tell what is best."
>
Check out these fine examples, which mirror my syntax, on the W3C site.
>
Internation alization Best Practices: Specifying Language in XHTML & HTML Content
http://www.w3.org/TR/i18n-html-tech-...0429.092928424
>
>
Tutorial: Declaring Language in XHTML and HTML (Draft)
http://www.w3.org/International/tuto...Slide0160.html
>
Juan, you wrote:
>But, it seems to me that setting xml:lang for the html tag's *attribute* values is unneeded, since they must
>be in English, and they must be attributes set to a language identifier, as defined by IETF RFC 4646
>(http://www.ietf.org/rfc/rfc4646.txt).
>
You're not setting it for "the tag's *attribute*", you're setting it for the *contents*, all contents, of the
element (unless overridden by a sub-setting), which makes perfect sense so that I don't have to set it
individuall y on every child element--that is the power of a hierarchy! You seem to be focused on the technical,
with some misunderstandin g, versus the spirit of what we're trying to accomplish: telling user agents who our
intended audiences is, by language, as best we can...which is why I'm *also* setting lang in the HTTP headers and
in page meta tags.
>
, Lee
>
>
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:OY******** ******@TK2MSFTN GP02.phx.gbl...
>re:
>!I found an MSDN document that explains why what I'm trying to do should work
>>
>Lee,
>>
>From :
>>
>http://www.w3.org/TR/REC-xml/
>>
>"A special attribute named xml:lang may be inserted in documents to specify the
>language used in the contents and attribute values of any element in an XML document."
>>
>If anything, I can see xml:lang being declared for specific content values, for example :
>>
><p xml:lang="en-GB">What colour is it?</p>
><p xml:lang="en-US">What color is it?</p>
>>
>Then, an xml parser could identify regional US and British spellings but, given that *all* the attribute values
>must be in English in an html doc, what would be the purpose of declaring xml:lang for the html markup ?
>>
>A similar explanation is given here :
>http://www.simonstl.com/xmlprim/xmlupdate/atts.html
>>
>---000---
><SECTION >
><DESCRIPTI ON xml:lang="en">
>Caesar begins by describing the geography of Gaul.
></DESCRIPTION>
><QUOTE xml:lang="la">
>Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae,
>aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli appellantur.
></QUOTE>
>---000---
>>
>That's perfectly good usage for xml:lang, as a parser could selectively identify content in different languages.
>>
>But, it seems to me that setting xml:lang for the html tag's *attribute* values is unneeded, since they must
>be in English, and they must be attributes set to a language identifier, as defined by IETF RFC 4646
>(http://www.ietf.org/rfc/rfc4646.txt).
>>
>So, I think that requisite pretty well establishes the futility
>of setting xml:lang for all the attributes in an html document.
>>
>If anything, it seems that the xml:lang attribute is included in the
>html server tag for compatibility purposes, or perhaps out of ignorance.
>>
>If there's a need to identify that the *contents* of a particular markup tag are in a
>specific language, that identification can be included in the tag itself, for example :
>>
><div lang="MX-es" xml:lang="MX-es">
>Algo de contenido en español mejicano.
></div>
>>
>That makes a lot more sense than setting xml:lang for the attribute values in the html tag.
>>
>>
>>
>Juan T. Llibre, asp.net MVP
>asp.net faq : http://asp.net.do/faq/
>foros de asp.net, en español : http://asp.net.do/foros/
>========== =============== =============
>"Lee C." <no*****@spamme r.comwrote in message news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>>>I found an MSDN document that explains why what I'm trying to do should work.
>>>
>>ASP.NET Web Server Controls Overview
>>http://msdn.microsoft.com/en-us/library/zsyt68f1.aspx
>>>
>>Note the distinction between HTML Server Controls and Web Server Controls in the document. Also, note the
>>explanati on
>>of "pass-through" attributes for HTML Server Controls.
>>>
>>Two quotes that sum it up:
>> 1. Any HTML element on a page can be converted to an HTML server control by adding the attribute
>>runat="se rver".
>> 2. You can add any attributes you need to an HTML server control and the page framework will render them
>>without
>>any change in functionality.
>>>
>>, Lee
>>>
>>"Lee C." <no*****@spamme r.comwrote in message news:Oe******** ******@TK2MSFTN GP03.phx.gbl...
>>>Juan,
>>>>
>>>I appreciate your trying to help, but you're wrong, and you are the one who is confused. :]
>>>>
>>>I am *not* disputing that when inserted programmaticall y, the xml:lang attribute renders to the browser. I did
>>>just
>>>that as a work around (right after I discovered this bug); but, I should not have to.
>>>>
>>>I am *not* confusing html attributes with runat="server" attributes, as you call them. Using your logic, none
>>>of the
>>>declarat ive (html) attributes should render to the browser after I add the runat="server" in ASP.NET; yet all
>>>of them
>>>(xmlns , lang, and dir) do--except xml:lang.
>>>>
>>>I started with an html element with 4 attributes (xmlns, lang, xml:lang, and dir) all set declaratively. With
>>>*no*
>>>5th attribute of runat="server", all 4 attributes render. If I add the 5th attribute of runat="server", which
>>>does
>>>not and should not render, I no longer get all 4 attributes that should render (xmlns, lang, xml:lang, and
>>>dir), I
>>>only get 3 (xmlns, lang, and dir). My logic says I should get 4, your says I should get 3? It would be 4 or
>>>0, and
>>>4 is right. Not 0...and not 3.
>>>>
>>>When I add runat="server", it does not magically make the xml:lang attribute a server-side attribute, while
>>>keepin g
>>>the other three attributes as "html" attributes. All four are still "html" attributes--which should render.
>>>>
>>>I think the simplification of my example may be confusing you. It is odd that, in my example, I set
>>>runat="s erver"
>>>but do not have any server-side attributes. (I have all 4 as literal strings, for simplicity of an example.)
>>>Well,
>>>in my real-world use, I do have server-side attributes, which I want set declaratively (no code-beside and no
>>>script ). I have:
>>>>
>>><html runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>> xml:lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
>>> lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
>>> dir="ltr">
>>>>
>>>Both of those declarative explicit localization expressions should work without my having to write any more
>>>"procedu ral" (code-beside) code or script. It actually does work fine for the lang attribute--as it should;
>>>but not
>>>for the xml:lang attribute--***which is a bug***.
>>>>
>>>, Lee
>>>>
>>>"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:u0******** ******@TK2MSFTN GP04.phx.gbl...
>>>>re:
>>>>!I think you are misunderstandin g, Juan.
>>>>>
>>>>Well, I think you are misunderstandin g *me*.
>>>>>
>>>>re:
>>>>!I had the xml:lang attribute in the html tag (declaratively) , like this:
>>>>>...a nd it renders to the browser, as it should.
>>>>>
>>>>Yes, because it's standard html.
>>>>>
>>>>re:
>>>>!If I simply add runat="server"
>>>>>
>>>>That declares the control to run server side.
>>>>>
>>>>For any attribute to be programmed server-side you need a script,
>>>>just as you need a script to modify any server control's attributes.
>>>>>
>>>>Did you run the sample page I sent ?
>>>>>
>>>>It iterates throught the attributes for the html server control,
>>>>and shows that the xml:lang attribute *is* added programmaticall y.
>>>>>
>>>>re:
>>>>!If I simply add runat="server", leaving in the xml:lang attribute that
>>>>!render s without runat="server", all of the (declarative) attributes are
>>>>!render ed to the browser--except the xml:lang attribute! That is a bug.
>>>>>
>>>>I think you're confusing html attributes with runat="server" attributes.
>>>>>
>>>>Html attributes can be inserted in normal html.
>>>>Serve r-side attributes must be inserted in code.
>>>>>
>>>>Maybe I'm not explaining this as well as I should.
>>>>Try to get someone else's opinion on this matter, if you don't accept mine.
>>>>>
>>>>>
>>>>>
>>>>Juan T. Llibre, asp.net MVP
>>>>asp.n et faq : http://asp.net.do/faq/
>>>>foros de asp.net, en español : http://asp.net.do/foros/
>>>>======= =============== =============== =
>>>>"Lee C." <no*****@spamme r.comwrote in message news:en******** ******@TK2MSFTN GP04.phx.gbl...
>>>>>>I think you are misunderstandin g, Juan. I had the xml:lang attribute in the html tag (declaratively) , like
>>>>>>thi s:
>>>>>>
>>>>><htm l xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>
>>>>>...a nd it renders to the browser, as it should.
>>>>>>
>>>>>If I simply add runat="server", leaving in the xml:lang attribute that renders without runat="server", all of
>>>>>the
>>>>>(decla rative) attributes are rendered to the browser--except the xml:lang attribute! That is a bug.
>>>>>>
>>>>><htm l runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>
>>>>>Cordia lly,
>>>>>Lee
>>>>>>
>>>>>>
>>>>>"Jua n T. Llibre" <no***********@ nowhere.comwrot e in message news:ey******** ******@TK2MSFTN GP02.phx.gbl...
>>>>>>Here' s a full example which shows that the xml:lang attribute is added programmaticall y :
>>>>>>>
>>>>>>attri butes.aspx:
>>>>>>----------------------
>>>>>><%@ Page Language="C#" AutoEventWireup ="True" %>
>>>>>><ht ml xmlns="http://www.w3.org/1999/xhtml" runat="server" id="Myid" >
>>>>>><scri pt language="C#" runat="server">
>>>>>>voi d Page_Load(Objec t sender, EventArgs e)
>>>>>>{
>>>>>>Myid. Attributes.Add( "xml:lang", "es");
>>>>>>Messa ge.InnerHtml = "<h4>The html control attributes collection contains:</h4>";
>>>>>>IEnum erator keys = Myid.Attributes .Keys.GetEnumer ator();
>>>>>>whi le (keys.MoveNext( ))
>>>>>>{
>>>>>>Strin g key = (String)keys.Cu rrent;
>>>>>>Messa ge.InnerHtml += key + "=" + Myid.Attributes[key] + "<br />";
>>>>>>}
>>>>>>}
>>>>>></script>
>>>>>><he ad id="Head1" runat="server">
>>>>>><titl e>The html control attributes collection</title>
>>>>>></head>
>>>>>><body >
>>>>>><fo rm id="Form1" runat="server">
>>>>>><h3>H tmlControl Attribute Collection Example</h3>
>>>>>><br />
>>>>>><sp an id="Message" enableviewstate ="false" runat="server" />
>>>>>></form>
>>>>>></body>
>>>>>></html>
>>>>>>----------------
>>>>>>>
>>>>>>I don't think it's a bug to have to add an attribute programmaticall y,
>>>>>>becau se the runat="server" tag only *declares* the html control as a programmable control.
>>>>>>>
>>>>>>To actually program it, you must use a script.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>Jua n T. Llibre, asp.net MVP
>>>>>>asp.n et faq : http://asp.net.do/faq/
>>>>>>for os de asp.net, en español : http://asp.net.do/foros/
>>>>>>===== =============== =============== ===
>>>>>>"Le e C." <no*****@spamme r.comwrote in message news:e0******** ******@TK2MSFTN GP03.phx.gbl...
>>>>>>>Than ks, Juan.
>>>>>>>>
>>>>>>>I already added similar code to a page event in my masterpage code-beside.
>>>>>>>>
>>>>>>> elHtml.Attribut es.Add("xml:lan g", Resources.Globa lLang.ContentAu dienceLanguage)
>>>>>>>>
>>>>>>>To me, that is a temporary workaround. I still want to understand whether the "eating" of the attribute I
>>>>>>>orig inally
>>>>>>>post ed about is a bug, or if this is actually happening for a reason.
>>>>>>>>
>>>>>>>Cord ially,
>>>>>>>Le e
>>>>>>>>
>>>>>>>>
>>>>>>>"Jua n T. Llibre" <no***********@ nowhere.comwrot e in message
>>>>>>>news :%2************ ****@TK2MSFTNGP 03.phx.gbl...
>>>>>>>>H i, Lee.
>>>>>>>>>
>>>>>>>>r e:
>>>>>>>>!<h tml runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>>>! no xml:lang attribute is rendered to the browser!
>>>>>>>>!Re move the runat="server", and, voila, the xml:lang attribute is rendered.
>>>>>>>>>
>>>>>>>>T ry this :
>>>>>>>>>
>>>>>>>><ht ml xmlns="http://www.w3.org/1999/xhtml" runat="server" id="someID">
>>>>>>>>>
>>>>>>>><sc ript runat="server">
>>>>>>>>som eID.Attributes( "xml:lang") = "en-US"
>>>>>>>></script>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>Jua n T. Llibre, asp.net MVP
>>>>>>>>asp .net faq : http://asp.net.do/faq/
>>>>>>>>for os de asp.net, en español : http://asp.net.do/foros/
>>>>>>>>=== =============== =============== =====
>>>>>>>>>
>>>>>>>>"Le e C." <no****@spam.co mwrote in message news:O%******** ********@TK2MSF TNGP03.phx.gbl. ..
>>>>>>>>> >I think I have discovered a bug in ASP.NET, related to I18N.
>>>>>>>>> >
>>>>>>>>> In ASP.NET 3.5 I have to set runat="server" on the html element to use explicit expressions. It appears
>>>>>>>>>th at
>>>>>>>>>AS P.NET
>>>>>>>>>ea ts the xml:lang attribute on the html element when it is set to runat="server".
>>>>>>>>> >
>>>>>>>>> Of course I want to replace the hardcoded "en-US" values with (resource) explicit expressions; but, for
>>>>>>>>>si mplicity,
>>>>>>>>>tr y this:
>>>>>>>>> >
>>>>>>>>><h tml runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>>>> >
>>>>>>>>>.. .And you will find that no xml:lang attribute is rendered to the browser! Remove the runat="server",
>>>>>>>>>an d,
>>>>>>>>>vo ila,
>>>>>>>>>th e
>>>>>>>>>xm l:lang attribute is rendered. :[
>>>>>>>>> >
>>>>>>>>>.. .Any ideas?
>>>>>>>>> >
>>>>>>>>>Co rdially,
>>>>>>>>>Le e
>>>>>>>>> >
>>>>>>>>> >
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>>
>>
>
>




Jun 29 '08 #7
Juan,

You clearly don't understand, or have not thought about *why* the ASP.NET
team gave us separate places for "design"/content (.aspx files) and
"procedure"/code (.aspx.vb). The ability to separate the 2 was a huge
feature for ASP.NET, from classic ASP.

Even though the particular content affected by the bug I found is not
*visible* Web browser content, it is content none-the-less. Thus, its
wiring belongs in the content file (.aspx)--not the code file (.aspx.vb).
Sure, I could throw in some classic ASP style, and put a script element in
my .aspx page to keep the wiring in the realm of the designer, but that
changes nothing, because it's still programming, which should be done by
programmers in the same place as every other line of programming in my site:
the .aspx.vb pages. Just as badly, it means I'm achieving my I18N wiring in
multiple ways, instead of being consistent.

By everything else, I meant all other I18N resource "wirings". (But, I take
pride in how "light" my .aspx.vb files are--and how clean my .aspx files
are, too.) You are obviously fine with having the designer(s) to set up and
manage *most* of the I18N wirings, *and* having programmers to do some, too,
(as they should not be doing) since bugs are not bugs for you if there is a
workaround that violates good design practices and principles. I'm not fine
with that.

Are you really an ASP.NET MVP? (Classic ASP, maybe?)

, Lee
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:ur******** ******@TK2MSFTN GP06.phx.gbl...
re:
!Setting it programmaticall y is an incorrect implementation
!when everything else on my page is set declaratively.

Is everything else on your pages set declaratively ?
Think about that for a second.

Why do we have inline scripts and code-behind, if "everything else is set
declaratively" ?

In any case, we've certainly had enough of the "I think that..." back and
forth.

Let's pause this discussion until the "bug" you reported is explained by
the VS Dev team, OK ?
I, definitely, want to see what their explanation is.

https://connect.microsoft.com/Visual...dbackID=353879

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Lee C." <no****@spam.co mwrote in message
news:eQ******** ******@TK2MSFTN GP05.phx.gbl...
>Correct implementation? What do you mean by that?

I stated earlier on that I worked around it. It's still a bug. Setting
it programmaticall y is an incorrect implementation when everything else
on my page is set declaratively. Microsoft offered declarative
(explicit) expressions, and I want to use them--anywhere and everywhere I
choose in accordance with how they are stated to work. When I find one
that doesn't work, it's a bug; it's not a case of my doing something
incorrectly. I love Microsoft Visual Studio 2008; but, I won't tolerate
bugs, or suck them up as, "Oh, I must be doing it wrong since it doesn't
work--even though it should."

, Lee

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:%2******* *********@TK2MS FTNGP04.phx.gbl ...
>>re:
!ASP.NET should make it easy for me--and, it does,
!but there is a bug in the implementation.

The fact that you *can* set xml:lang programmaticall y, and that you
*did* set it that way,
as I did, should tell you that it isn't much of a bug, but a question of
using the correct implementation.

But, again, please let us know what the reply to your bug report is.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============= =============== ==========
"Lee C." <no****@spam.co mwrote in message
news:%2****** **********@TK2M SFTNGP04.phx.gb l...
Juan,

My use of language and culture in ASP.Net is a bit different than most.
I have registered numerous country-code-specific domains (mysite.ca,
mysite.co.uk , mysite.com.au, etc.), which resolve to a singular
"ASP.Net Web Site". Nothing new there. However, I'm not doing the
ASP.Net usual of letting the user agent (HTTP header 'accept-language')
determine which language visitors get; I have the country-code TLD
drive it. Also, it's not just the language of my content that varies
by cc TLD, it's the content, too; but, lang attributes play a critical
role in informing user agents (including search engine bots) for what
"country" my content is aimed.

I have already found, first-hand, that the better of the major search
engines use the cc TLD *and* the HTML lang/xml:lang to determine
whether a domain's documents (mysite.com.au/my-document.aspx) should
show up when a searcher searches with the 'Only from Australia'
checkbox checked on Live.com, for example.

I'm not setting lang attributes for fun; I'm doing it to correct search
engine results. ASP.NET should make it easy for me--and, it does, but
there is a bug in the implementation.

I appreciate your interest and effort to help.

, Lee
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:uB***** *********@TK2MS FTNGP03.phx.gbl ...
re:
!versus the spirit of what we're trying to accomplish: telling user
agents who our
!intended audiences is, by language, as best we can...which is why
I'm *also*
!setting lang in the HTTP headers and in page meta tags
>
What ? You don't set a language/culture in web.config, too ?
There's a use for overkill ! ( only kidding... )
>
I don't see too clearly the purpose of declaring a single language for
a web page.
>
I do see a use for declaring specific language attributes in a
*collection * of xml documents,
so that individual documents can be parsed for a particular language
content.
>
But, ymmv...
>
I'd still be interested in knowing what the reply is to your bug
report.
I bet you'll get back : "That's by design". <g>
>
Don't forget to let us all know what happens with that, OK ?
Thanks for an interesting discussion.
>
>
>
>
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=========== =============== ============
"Lee C." <no****@spam.co mwrote in message
news:en**** *********@TK2MS FTNGP05.phx.gbl ...
>Juan,
>>
>In theory, I like your idea of investigating "the standard"; but, in
>practice it has serious problems, as it often does. First, you are
>referrin g to the XML standard, which is not as appropriate as HTML
>and XHTML standards. Second, none of them are crystal clear on best
>practice s for I18N. There is a lot of *legal* (by the standard)
>syntax, that makes no sense, or makes some sense without being
>clearly best. The W3C site often states something to the effect of,
>"some are doing this, some are doing that, on your own site, at least
>do something and only time will tell what is best."
>>
>Check out these fine examples, which mirror my syntax, on the W3C
>site.
>>
>Internatio nalization Best Practices: Specifying Language in XHTML &
>HTML Content
>http://www.w3.org/TR/i18n-html-tech-...0429.092928424
>>
>>
>Tutorial : Declaring Language in XHTML and HTML (Draft)
>http://www.w3.org/International/tuto...Slide0160.html
>>
>Juan, you wrote:
>>But, it seems to me that setting xml:lang for the html tag's
>>*attribut e* values is unneeded, since they must
>>be in English, and they must be attributes set to a language
>>identifie r, as defined by IETF RFC 4646
>>(http://www.ietf.org/rfc/rfc4646.txt).
>>
>You're not setting it for "the tag's *attribute*", you're setting it
>for the *contents*, all contents, of the element (unless overridden
>by a sub-setting), which makes perfect sense so that I don't have to
>set it individually on every child element--that is the power of a
>hierarch y! You seem to be focused on the technical, with some
>misunderst anding, versus the spirit of what we're trying to
>accomplish : telling user agents who our intended audiences is, by
>language , as best we can...which is why I'm *also* setting lang in
>the HTTP headers and in page meta tags.
>>
>, Lee
>>
>>
>"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
>news:OY*** ***********@TK2 MSFTNGP02.phx.g bl...
>>re:
>>!I found an MSDN document that explains why what I'm trying to do
>>should work
>>>
>>Lee,
>>>
>>From :
>>>
>>http://www.w3.org/TR/REC-xml/
>>>
>>"A special attribute named xml:lang may be inserted in documents to
>>specify the
>>languag e used in the contents and attribute values of any element in
>>an XML document."
>>>
>>If anything, I can see xml:lang being declared for specific content
>>values, for example :
>>>
>><p xml:lang="en-GB">What colour is it?</p>
>><p xml:lang="en-US">What color is it?</p>
>>>
>>Then, an xml parser could identify regional US and British spellings
>>but, given that *all* the attribute values
>>must be in English in an html doc, what would be the purpose of
>>declari ng xml:lang for the html markup ?
>>>
>>A similar explanation is given here :
>>http://www.simonstl.com/xmlprim/xmlupdate/atts.html
>>>
>>---000---
>><SECTIO N>
>><DESCRIPT ION xml:lang="en">
>>Caesar begins by describing the geography of Gaul.
>></DESCRIPTION>
>><QUOTE xml:lang="la">
>>Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae,
>>aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli
>>appellant ur.
>></QUOTE>
>>---000---
>>>
>>That's perfectly good usage for xml:lang, as a parser could
>>selective ly identify content in different languages.
>>>
>>But, it seems to me that setting xml:lang for the html tag's
>>*attribut e* values is unneeded, since they must
>>be in English, and they must be attributes set to a language
>>identifie r, as defined by IETF RFC 4646
>>(http://www.ietf.org/rfc/rfc4646.txt).
>>>
>>So, I think that requisite pretty well establishes the futility
>>of setting xml:lang for all the attributes in an html document.
>>>
>>If anything, it seems that the xml:lang attribute is included in the
>>html server tag for compatibility purposes, or perhaps out of
>>ignorance .
>>>
>>If there's a need to identify that the *contents* of a particular
>>markup tag are in a
>>specifi c language, that identification can be included in the tag
>>itself, for example :
>>>
>><div lang="MX-es" xml:lang="MX-es">
>>Algo de contenido en español mejicano.
>></div>
>>>
>>That makes a lot more sense than setting xml:lang for the attribute
>>values in the html tag.
>>>
>>>
>>>
>>Juan T. Llibre, asp.net MVP
>>asp.net faq : http://asp.net.do/faq/
>>foros de asp.net, en español : http://asp.net.do/foros/
>>========= =============== ==============
>>"Lee C." <no*****@spamme r.comwrote in message
>>news:%2** **************@ TK2MSFTNGP04.ph x.gbl...
>>>>I found an MSDN document that explains why what I'm trying to do
>>>>shoul d work.
>>>>
>>>ASP.NE T Web Server Controls Overview
>>>http://msdn.microsoft.com/en-us/library/zsyt68f1.aspx
>>>>
>>>Note the distinction between HTML Server Controls and Web Server
>>>Contro ls in the document. Also, note the explanation
>>>of "pass-through" attributes for HTML Server Controls.
>>>>
>>>Two quotes that sum it up:
>>> 1. Any HTML element on a page can be converted to an HTML server
>>>contro l by adding the attribute runat="server".
>>> 2. You can add any attributes you need to an HTML server control
>>>and the page framework will render them without
>>>any change in functionality.
>>>>
>>>, Lee
>>>>
>>>"Lee C." <no*****@spamme r.comwrote in message
>>>news:Oe* *************@T K2MSFTNGP03.phx .gbl...
>>>>Juan,
>>>>>
>>>>I appreciate your trying to help, but you're wrong, and you are
>>>>the one who is confused. :]
>>>>>
>>>>I am *not* disputing that when inserted programmaticall y, the
>>>>xml:lan g attribute renders to the browser. I did just
>>>>that as a work around (right after I discovered this bug); but, I
>>>>shoul d not have to.
>>>>>
>>>>I am *not* confusing html attributes with runat="server"
>>>>attribu tes, as you call them. Using your logic, none of the
>>>>declara tive (html) attributes should render to the browser after I
>>>>add the runat="server" in ASP.NET; yet all of them
>>>>(xmln s, lang, and dir) do--except xml:lang.
>>>>>
>>>>I started with an html element with 4 attributes (xmlns, lang,
>>>>xml:lan g, and dir) all set declaratively. With *no*
>>>>5th attribute of runat="server", all 4 attributes render. If I
>>>>add the 5th attribute of runat="server", which does
>>>>not and should not render, I no longer get all 4 attributes that
>>>>shoul d render (xmlns, lang, xml:lang, and dir), I
>>>>only get 3 (xmlns, lang, and dir). My logic says I should get 4,
>>>>your says I should get 3? It would be 4 or 0, and
>>>>4 is right. Not 0...and not 3.
>>>>>
>>>>When I add runat="server", it does not magically make the xml:lang
>>>>attribu te a server-side attribute, while keeping
>>>>the other three attributes as "html" attributes. All four are
>>>>still "html" attributes--which should render.
>>>>>
>>>>I think the simplification of my example may be confusing you. It
>>>>is odd that, in my example, I set runat="server"
>>>>but do not have any server-side attributes. (I have all 4 as
>>>>liter al strings, for simplicity of an example.) Well,
>>>>in my real-world use, I do have server-side attributes, which I
>>>>want set declaratively (no code-beside and no
>>>>script) . I have:
>>>>>
>>>><html runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>>> xml:lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
>>>> lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
>>>> dir="ltr">
>>>>>
>>>>Both of those declarative explicit localization expressions should
>>>>work without my having to write any more
>>>>"proced ural" (code-beside) code or script. It actually does work
>>>>fine for the lang attribute--as it should; but not
>>>>for the xml:lang attribute--***which is a bug***.
>>>>>
>>>>, Lee
>>>>>
>>>>"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
>>>>news:u0 **************@ TK2MSFTNGP04.ph x.gbl...
>>>>>re:
>>>>>!I think you are misunderstandin g, Juan.
>>>>>>
>>>>>Well , I think you are misunderstandin g *me*.
>>>>>>
>>>>>re:
>>>>>!I had the xml:lang attribute in the html tag (declaratively) ,
>>>>>like this:
>>>>>>...an d it renders to the browser, as it should.
>>>>>>
>>>>>Yes, because it's standard html.
>>>>>>
>>>>>re:
>>>>>!If I simply add runat="server"
>>>>>>
>>>>>That declares the control to run server side.
>>>>>>
>>>>>For any attribute to be programmed server-side you need a script,
>>>>>just as you need a script to modify any server control's
>>>>>attrib utes.
>>>>>>
>>>>>Did you run the sample page I sent ?
>>>>>>
>>>>>It iterates throught the attributes for the html server control,
>>>>>and shows that the xml:lang attribute *is* added
>>>>>progra mmatically.
>>>>>>
>>>>>re:
>>>>>!If I simply add runat="server", leaving in the xml:lang
>>>>>attrib ute that
>>>>>!rende rs without runat="server", all of the (declarative)
>>>>>attrib utes are
>>>>>!rende red to the browser--except the xml:lang attribute! That
>>>>>is a bug.
>>>>>>
>>>>>I think you're confusing html attributes with runat="server"
>>>>>attrib utes.
>>>>>>
>>>>>Html attributes can be inserted in normal html.
>>>>>Serv er-side attributes must be inserted in code.
>>>>>>
>>>>>Mayb e I'm not explaining this as well as I should.
>>>>>Try to get someone else's opinion on this matter, if you don't
>>>>>acce pt mine.
>>>>>>
>>>>>>
>>>>>>
>>>>>Juan T. Llibre, asp.net MVP
>>>>>asp.ne t faq : http://asp.net.do/faq/
>>>>>foro s de asp.net, en español : http://asp.net.do/foros/
>>>>>====== =============== =============== ==
>>>>>"Lee C." <no*****@spamme r.comwrote in message
>>>>>news:e n************** @TK2MSFTNGP04.p hx.gbl...
>>>>>>>I think you are misunderstandin g, Juan. I had the xml:lang
>>>>>>>attr ibute in the html tag (declaratively) , like this:
>>>>>>>
>>>>>><ht ml xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"
>>>>>>lang= "en-US" dir="ltr">
>>>>>>>
>>>>>>...an d it renders to the browser, as it should.
>>>>>>>
>>>>>>If I simply add runat="server", leaving in the xml:lang
>>>>>>attri bute that renders without runat="server", all of the
>>>>>>(decl arative) attributes are rendered to the browser--except the
>>>>>>xml:l ang attribute! That is a bug.
>>>>>>>
>>>>>><ht ml runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>>>>>xml:l ang="en-US" lang="en-US" dir="ltr">
>>>>>>>
>>>>>>Cordi ally,
>>>>>>Lee
>>>>>>>
>>>>>>>
>>>>>>"Ju an T. Llibre" <no***********@ nowhere.comwrot e in message
>>>>>>news: ey************* *@TK2MSFTNGP02. phx.gbl...
>>>>>>>Here 's a full example which shows that the xml:lang attribute
>>>>>>>is added programmaticall y :
>>>>>>>>
>>>>>>>attr ibutes.aspx:
>>>>>>>----------------------
>>>>>>><% @ Page Language="C#" AutoEventWireup ="True" %>
>>>>>>><htm l xmlns="http://www.w3.org/1999/xhtml" runat="server"
>>>>>>>id=" Myid" >
>>>>>>><scr ipt language="C#" runat="server">
>>>>>>>vo id Page_Load(Objec t sender, EventArgs e)
>>>>>>>{
>>>>>>>Myid .Attributes.Add ("xml:lang", "es");
>>>>>>>Mess age.InnerHtml = "<h4>The html control attributes collection
>>>>>>>cont ains:</h4>";
>>>>>>>IEnu merator keys = Myid.Attributes .Keys.GetEnumer ator();
>>>>>>>whil e (keys.MoveNext( ))
>>>>>>>{
>>>>>>>Stri ng key = (String)keys.Cu rrent;
>>>>>>>Mess age.InnerHtml += key + "=" + Myid.Attributes[key] + "<br
>>>>>>>/>";
>>>>>>>}
>>>>>>>}
>>>>>>></script>
>>>>>>><hea d id="Head1" runat="server">
>>>>>>><tit le>The html control attributes collection</title>
>>>>>>></head>
>>>>>>><bod y>
>>>>>>><for m id="Form1" runat="server">
>>>>>>><h3> HtmlControl Attribute Collection Example</h3>
>>>>>>><b r />
>>>>>>><spa n id="Message" enableviewstate ="false" runat="server" />
>>>>>>></form>
>>>>>>></body>
>>>>>>></html>
>>>>>>>----------------
>>>>>>>>
>>>>>>>I don't think it's a bug to have to add an attribute
>>>>>>>prog rammatically,
>>>>>>>beca use the runat="server" tag only *declares* the html control
>>>>>>>as a programmable control.
>>>>>>>>
>>>>>>>To actually program it, you must use a script.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>Ju an T. Llibre, asp.net MVP
>>>>>>>asp. net faq : http://asp.net.do/faq/
>>>>>>>foro s de asp.net, en español : http://asp.net.do/foros/
>>>>>>>==== =============== =============== ====
>>>>>>>"L ee C." <no*****@spamme r.comwrote in message
>>>>>>>news :e0************ **@TK2MSFTNGP03 .phx.gbl...
>>>>>>>>Tha nks, Juan.
>>>>>>>>>
>>>>>>>>I already added similar code to a page event in my masterpage
>>>>>>>>cod e-beside.
>>>>>>>>>
>>>>>>>> elHtml.Attribut es.Add("xml:lan g",
>>>>>>>>Res ources.GlobalLa ng.ContentAudie nceLanguage)
>>>>>>>>>
>>>>>>>>T o me, that is a temporary workaround. I still want to
>>>>>>>>und erstand whether the "eating" of the attribute I
>>>>>>>>ori ginally
>>>>>>>>pos ted about is a bug, or if this is actually happening for a
>>>>>>>>rea son.
>>>>>>>>>
>>>>>>>>Cor dially,
>>>>>>>>L ee
>>>>>>>>>
>>>>>>>>>
>>>>>>>>"Ju an T. Llibre" <no***********@ nowhere.comwrot e in message
>>>>>>>>new s:%2*********** *****@TK2MSFTNG P03.phx.gbl...
>>>>>>>>>Hi , Lee.
>>>>>>>>> >
>>>>>>>>>re :
>>>>>>>>>!< html runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>>>>>>>>xm l:lang="en-US" lang="en-US" dir="ltr">
>>>>>>>>>!n o xml:lang attribute is rendered to the browser!
>>>>>>>>>!R emove the runat="server", and, voila, the xml:lang
>>>>>>>>>at tribute is rendered.
>>>>>>>>> >
>>>>>>>>>Tr y this :
>>>>>>>>> >
>>>>>>>>><h tml xmlns="http://www.w3.org/1999/xhtml" runat="server"
>>>>>>>>>id ="someID">
>>>>>>>>> >
>>>>>>>>><s cript runat="server">
>>>>>>>>>so meID.Attributes ("xml:lang") = "en-US"
>>>>>>>>> </script>
>>>>>>>>> >
>>>>>>>>> >
>>>>>>>>> >
>>>>>>>>>Ju an T. Llibre, asp.net MVP
>>>>>>>>>as p.net faq : http://asp.net.do/faq/
>>>>>>>>>fo ros de asp.net, en español : http://asp.net.do/foros/
>>>>>>>>>== =============== =============== ======
>>>>>>>>> >
>>>>>>>>>"L ee C." <no****@spam.co mwrote in message
>>>>>>>>>ne ws:O%********** ******@TK2MSFTN GP03.phx.gbl...
>>>>>>>>>>> I think I have discovered a bug in ASP.NET, related to I18N.
>>>>>>>>> >>
>>>>>>>>>>I n ASP.NET 3.5 I have to set runat="server" on the html
>>>>>>>>>>e lement to use explicit expressions. It appears that
>>>>>>>>>>A SP.NET
>>>>>>>>>>e ats the xml:lang attribute on the html element when it is
>>>>>>>>>>s et to runat="server".
>>>>>>>>> >>
>>>>>>>>>>O f course I want to replace the hardcoded "en-US" values
>>>>>>>>>>w ith (resource) explicit expressions; but, for
>>>>>>>>>>s implicity,
>>>>>>>>>>t ry this:
>>>>>>>>> >>
>>>>>>>>>>< html runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>>>>>>>>>x ml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>>>> >>
>>>>>>>>>>. ..And you will find that no xml:lang attribute is rendered
>>>>>>>>>>t o the browser! Remove the runat="server", and,
>>>>>>>>>>v oila,
>>>>>>>>>>t he
>>>>>>>>>>x ml:lang attribute is rendered. :[
>>>>>>>>> >>
>>>>>>>>>>. ..Any ideas?
>>>>>>>>> >>
>>>>>>>>>>C ordially,
>>>>>>>>>>L ee
>>>>>>>>> >>
>>>>>>>>> >>
>>>>>>>>> >
>>>>>>>>> >
>>>>>>>>> >
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>>
>
>




Jun 29 '08 #8
re:
!You clearly don't understand

That "clearly" is doubted by me.

How many times have I told you that I *do* understand what you're saying
but that I'd like to see the bug response team's reply to your "bug report" ?

How many times will you repeat that I "don't understand", when I do,
although I disagree with the premises you're putting forth ?

re:
!Are you really an ASP.NET MVP? (Classic ASP, maybe?)

The answer to that question is in my signature.
Maybe you haven't read any of the ASP.NET books I've co-authored ?

Good luck with the response to your bug report.
Please remember to post the result here.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Lee C." <no****@spam.co mwrote in message news:eE******** ******@TK2MSFTN GP03.phx.gbl...
Juan,

You clearly don't understand, or have not thought about *why* the ASP.NET team gave us separate places for
"design"/content (.aspx files) and "procedure"/code (.aspx.vb). The ability to separate the 2 was a huge feature for
ASP.NET, from classic ASP.

Even though the particular content affected by the bug I found is not *visible* Web browser content, it is content
none-the-less. Thus, its wiring belongs in the content file (.aspx)--not the code file (.aspx.vb). Sure, I could
throw in some classic ASP style, and put a script element in my .aspx page to keep the wiring in the realm of the
designer, but that changes nothing, because it's still programming, which should be done by programmers in the same
place as every other line of programming in my site: the .aspx.vb pages. Just as badly, it means I'm achieving my
I18N wiring in multiple ways, instead of being consistent.

By everything else, I meant all other I18N resource "wirings". (But, I take pride in how "light" my .aspx.vb files
are--and how clean my .aspx files are, too.) You are obviously fine with having the designer(s) to set up and manage
*most* of the I18N wirings, *and* having programmers to do some, too, (as they should not be doing) since bugs are not
bugs for you if there is a workaround that violates good design practices and principles. I'm not fine with that.

Are you really an ASP.NET MVP? (Classic ASP, maybe?)

, Lee
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:ur******** ******@TK2MSFTN GP06.phx.gbl...
>re:
!Setting it programmaticall y is an incorrect implementation
!when everything else on my page is set declaratively.

Is everything else on your pages set declaratively ?
Think about that for a second.

Why do we have inline scripts and code-behind, if "everything else is set declaratively" ?

In any case, we've certainly had enough of the "I think that..." back and forth.

Let's pause this discussion until the "bug" you reported is explained by the VS Dev team, OK ?
I, definitely, want to see what their explanation is.

https://connect.microsoft.com/Visual...dbackID=353879

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============== =============== =========
"Lee C." <no****@spam.co mwrote in message news:eQ******** ******@TK2MSFTN GP05.phx.gbl...
>>Correct implementation? What do you mean by that?

I stated earlier on that I worked around it. It's still a bug. Setting it programmaticall y is an incorrect
implementatio n when everything else on my page is set declaratively. Microsoft offered declarative (explicit)
expressions , and I want to use them--anywhere and everywhere I choose in accordance with how they are stated to
work. When I find one that doesn't work, it's a bug; it's not a case of my doing something incorrectly. I love
Microsoft Visual Studio 2008; but, I won't tolerate bugs, or suck them up as, "Oh, I must be doing it wrong since it
doesn't work--even though it should."

, Lee

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
re:
!ASP.NET should make it easy for me--and, it does,
!but there is a bug in the implementation.

The fact that you *can* set xml:lang programmaticall y, and that you *did* set it that way,
as I did, should tell you that it isn't much of a bug, but a question of using the correct implementation.

But, again, please let us know what the reply to your bug report is.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============ =============== ===========
"Lee C." <no****@spam.co mwrote in message news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Juan,
>
My use of language and culture in ASP.Net is a bit different than most. I have registered numerous
country-code-specific domains (mysite.ca, mysite.co.uk, mysite.com.au, etc.), which resolve to a singular "ASP.Net
Web Site". Nothing new there. However, I'm not doing the ASP.Net usual of letting the user agent (HTTP header
'accept-language') determine which language visitors get; I have the country-code TLD drive it. Also, it's not
just the language of my content that varies by cc TLD, it's the content, too; but, lang attributes play a critical
role in informing user agents (including search engine bots) for what "country" my content is aimed.
>
I have already found, first-hand, that the better of the major search engines use the cc TLD *and* the HTML
lang/xml:lang to determine whether a domain's documents (mysite.com.au/my-document.aspx) should show up when a
searcher searches with the 'Only from Australia' checkbox checked on Live.com, for example.
>
I'm not setting lang attributes for fun; I'm doing it to correct search engine results. ASP.NET should make it
easy for me--and, it does, but there is a bug in the implementation.
>
I appreciate your interest and effort to help.
>
, Lee
>
>
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:uB******** ******@TK2MSFTN GP03.phx.gbl...
>re:
>!versus the spirit of what we're trying to accomplish: telling user agents who our
>!intende d audiences is, by language, as best we can...which is why I'm *also*
>!setting lang in the HTTP headers and in page meta tags
>>
>What ? You don't set a language/culture in web.config, too ?
>There's a use for overkill ! ( only kidding... )
>>
>I don't see too clearly the purpose of declaring a single language for a web page.
>>
>I do see a use for declaring specific language attributes in a *collection* of xml documents,
>so that individual documents can be parsed for a particular language content.
>>
>But, ymmv...
>>
>I'd still be interested in knowing what the reply is to your bug report.
>I bet you'll get back : "That's by design". <g>
>>
>Don't forget to let us all know what happens with that, OK ?
>Thanks for an interesting discussion.
>>
>>
>>
>>
>Juan T. Llibre, asp.net MVP
>asp.net faq : http://asp.net.do/faq/
>foros de asp.net, en español : http://asp.net.do/foros/
>========== =============== =============
>"Lee C." <no****@spam.co mwrote in message news:en******** *****@TK2MSFTNG P05.phx.gbl...
>>Juan,
>>>
>>In theory, I like your idea of investigating "the standard"; but, in practice it has serious problems, as it
>>often does. First, you are referring to the XML standard, which is not as appropriate as HTML and XHTML
>>standards . Second, none of them are crystal clear on best practices for I18N. There is a lot of *legal* (by the
>>standar d) syntax, that makes no sense, or makes some sense without being clearly best. The W3C site often
>>states something to the effect of, "some are doing this, some are doing that, on your own site, at least do
>>somethi ng and only time will tell what is best."
>>>
>>Check out these fine examples, which mirror my syntax, on the W3C site.
>>>
>>Internati onalization Best Practices: Specifying Language in XHTML & HTML Content
>>http://www.w3.org/TR/i18n-html-tech-...0429.092928424
>>>
>>>
>>Tutoria l: Declaring Language in XHTML and HTML (Draft)
>>http://www.w3.org/International/tuto...Slide0160.html
>>>
>>Juan, you wrote:
>>>But, it seems to me that setting xml:lang for the html tag's *attribute* values is unneeded, since they must
>>>be in English, and they must be attributes set to a language identifier, as defined by IETF RFC 4646
>>>(http://www.ietf.org/rfc/rfc4646.txt).
>>>
>>You're not setting it for "the tag's *attribute*", you're setting it for the *contents*, all contents, of the
>>element (unless overridden by a sub-setting), which makes perfect sense so that I don't have to set it
>>individua lly on every child element--that is the power of a hierarchy! You seem to be focused on the technical,
>>with some misunderstandin g, versus the spirit of what we're trying to accomplish: telling user agents who our
>>intende d audiences is, by language, as best we can...which is why I'm *also* setting lang in the HTTP headers
>>and in page meta tags.
>>>
>>, Lee
>>>
>>>
>>"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:OY******** ******@TK2MSFTN GP02.phx.gbl...
>>>re:
>>>!I found an MSDN document that explains why what I'm trying to do should work
>>>>
>>>Lee,
>>>>
>>>From :
>>>>
>>>http://www.w3.org/TR/REC-xml/
>>>>
>>>"A special attribute named xml:lang may be inserted in documents to specify the
>>>langua ge used in the contents and attribute values of any element in an XML document."
>>>>
>>>If anything, I can see xml:lang being declared for specific content values, for example :
>>>>
>>><p xml:lang="en-GB">What colour is it?</p>
>>><p xml:lang="en-US">What color is it?</p>
>>>>
>>>Then, an xml parser could identify regional US and British spellings but, given that *all* the attribute values
>>>must be in English in an html doc, what would be the purpose of declaring xml:lang for the html markup ?
>>>>
>>>A similar explanation is given here :
>>>http://www.simonstl.com/xmlprim/xmlupdate/atts.html
>>>>
>>>---000---
>>><SECTION >
>>><DESCRIP TION xml:lang="en">
>>>Caesar begins by describing the geography of Gaul.
>>></DESCRIPTION>
>>><QUOTE xml:lang="la">
>>>Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae,
>>>aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli appellantur.
>>></QUOTE>
>>>---000---
>>>>
>>>That's perfectly good usage for xml:lang, as a parser could selectively identify content in different
>>>language s.
>>>>
>>>But, it seems to me that setting xml:lang for the html tag's *attribute* values is unneeded, since they must
>>>be in English, and they must be attributes set to a language identifier, as defined by IETF RFC 4646
>>>(http://www.ietf.org/rfc/rfc4646.txt).
>>>>
>>>So, I think that requisite pretty well establishes the futility
>>>of setting xml:lang for all the attributes in an html document.
>>>>
>>>If anything, it seems that the xml:lang attribute is included in the
>>>html server tag for compatibility purposes, or perhaps out of ignorance.
>>>>
>>>If there's a need to identify that the *contents* of a particular markup tag are in a
>>>specif ic language, that identification can be included in the tag itself, for example :
>>>>
>>><div lang="MX-es" xml:lang="MX-es">
>>>Algo de contenido en español mejicano.
>>></div>
>>>>
>>>That makes a lot more sense than setting xml:lang for the attribute values in the html tag.
>>>>
>>>>
>>>>
>>>Juan T. Llibre, asp.net MVP
>>>asp.ne t faq : http://asp.net.do/faq/
>>>foros de asp.net, en español : http://asp.net.do/foros/
>>>======== =============== ===============
>>>"Lee C." <no*****@spamme r.comwrote in message news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>>>>>I found an MSDN document that explains why what I'm trying to do should work.
>>>>>
>>>>ASP.N ET Web Server Controls Overview
>>>>http://msdn.microsoft.com/en-us/library/zsyt68f1.aspx
>>>>>
>>>>Note the distinction between HTML Server Controls and Web Server Controls in the document. Also, note the
>>>>explana tion
>>>>of "pass-through" attributes for HTML Server Controls.
>>>>>
>>>>Two quotes that sum it up:
>>>> 1. Any HTML element on a page can be converted to an HTML server control by adding the attribute
>>>>runat=" server".
>>>> 2. You can add any attributes you need to an HTML server control and the page framework will render them
>>>>witho ut
>>>>any change in functionality.
>>>>>
>>>>, Lee
>>>>>
>>>>"Lee C." <no*****@spamme r.comwrote in message news:Oe******** ******@TK2MSFTN GP03.phx.gbl...
>>>>>Juan ,
>>>>>>
>>>>>I appreciate your trying to help, but you're wrong, and you are the one who is confused. :]
>>>>>>
>>>>>I am *not* disputing that when inserted programmaticall y, the xml:lang attribute renders to the browser. I
>>>>>did just
>>>>>that as a work around (right after I discovered this bug); but, I should not have to.
>>>>>>
>>>>>I am *not* confusing html attributes with runat="server" attributes, as you call them. Using your logic,
>>>>>none of the
>>>>>declar ative (html) attributes should render to the browser after I add the runat="server" in ASP.NET; yet all
>>>>>of them
>>>>>(xmlns , lang, and dir) do--except xml:lang.
>>>>>>
>>>>>I started with an html element with 4 attributes (xmlns, lang, xml:lang, and dir) all set declaratively.
>>>>>With *no*
>>>>>5th attribute of runat="server", all 4 attributes render. If I add the 5th attribute of runat="server",
>>>>>whic h does
>>>>>not and should not render, I no longer get all 4 attributes that should render (xmlns, lang, xml:lang, and
>>>>>dir) , I
>>>>>only get 3 (xmlns, lang, and dir). My logic says I should get 4, your says I should get 3? It would be 4 or
>>>>>0, and
>>>>>4 is right. Not 0...and not 3.
>>>>>>
>>>>>When I add runat="server", it does not magically make the xml:lang attribute a server-side attribute, while
>>>>>keepin g
>>>>>the other three attributes as "html" attributes. All four are still "html" attributes--which should render.
>>>>>>
>>>>>I think the simplification of my example may be confusing you. It is odd that, in my example, I set
>>>>>runat= "server"
>>>>>but do not have any server-side attributes. (I have all 4 as literal strings, for simplicity of an example.)
>>>>>Well ,
>>>>>in my real-world use, I do have server-side attributes, which I want set declaratively (no code-beside and no
>>>>>script ). I have:
>>>>>>
>>>>><htm l runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>>>> xml:lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
>>>>> lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
>>>>> dir="ltr">
>>>>>>
>>>>>Both of those declarative explicit localization expressions should work without my having to write any more
>>>>>"proce dural" (code-beside) code or script. It actually does work fine for the lang attribute--as it should;
>>>>>but not
>>>>>for the xml:lang attribute--***which is a bug***.
>>>>>>
>>>>>, Lee
>>>>>>
>>>>>"Jua n T. Llibre" <no***********@ nowhere.comwrot e in message news:u0******** ******@TK2MSFTN GP04.phx.gbl...
>>>>>>re:
>>>>>>!I think you are misunderstandin g, Juan.
>>>>>>>
>>>>>>Wel l, I think you are misunderstandin g *me*.
>>>>>>>
>>>>>>re:
>>>>>>!I had the xml:lang attribute in the html tag (declaratively) , like this:
>>>>>>>...a nd it renders to the browser, as it should.
>>>>>>>
>>>>>>Yes , because it's standard html.
>>>>>>>
>>>>>>re:
>>>>>>!If I simply add runat="server"
>>>>>>>
>>>>>>Tha t declares the control to run server side.
>>>>>>>
>>>>>>For any attribute to be programmed server-side you need a script,
>>>>>>jus t as you need a script to modify any server control's attributes.
>>>>>>>
>>>>>>Did you run the sample page I sent ?
>>>>>>>
>>>>>>It iterates throught the attributes for the html server control,
>>>>>>and shows that the xml:lang attribute *is* added programmaticall y.
>>>>>>>
>>>>>>re:
>>>>>>!If I simply add runat="server", leaving in the xml:lang attribute that
>>>>>>!rend ers without runat="server", all of the (declarative) attributes are
>>>>>>!rend ered to the browser--except the xml:lang attribute! That is a bug.
>>>>>>>
>>>>>>I think you're confusing html attributes with runat="server" attributes.
>>>>>>>
>>>>>>Htm l attributes can be inserted in normal html.
>>>>>>Serve r-side attributes must be inserted in code.
>>>>>>>
>>>>>>May be I'm not explaining this as well as I should.
>>>>>>Try to get someone else's opinion on this matter, if you don't accept mine.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>Jua n T. Llibre, asp.net MVP
>>>>>>asp.n et faq : http://asp.net.do/faq/
>>>>>>for os de asp.net, en español : http://asp.net.do/foros/
>>>>>>===== =============== =============== ===
>>>>>>"Le e C." <no*****@spamme r.comwrote in message news:en******** ******@TK2MSFTN GP04.phx.gbl...
>>>>>>>>I think you are misunderstandin g, Juan. I had the xml:lang attribute in the html tag (declaratively) , like
>>>>>>>>thi s:
>>>>>>>>
>>>>>>><htm l xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>>>
>>>>>>>...a nd it renders to the browser, as it should.
>>>>>>>>
>>>>>>>If I simply add runat="server", leaving in the xml:lang attribute that renders without runat="server", all
>>>>>>>of the
>>>>>>>(dec larative) attributes are rendered to the browser--except the xml:lang attribute! That is a bug.
>>>>>>>>
>>>>>>><htm l runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>>>
>>>>>>>Cord ially,
>>>>>>>Le e
>>>>>>>>
>>>>>>>>
>>>>>>>"Jua n T. Llibre" <no***********@ nowhere.comwrot e in message news:ey******** ******@TK2MSFTN GP02.phx.gbl...
>>>>>>>>Her e's a full example which shows that the xml:lang attribute is added programmaticall y :
>>>>>>>>>
>>>>>>>>att ributes.aspx:
>>>>>>>>----------------------
>>>>>>>>< %@ Page Language="C#" AutoEventWireup ="True" %>
>>>>>>>><ht ml xmlns="http://www.w3.org/1999/xhtml" runat="server" id="Myid" >
>>>>>>>><sc ript language="C#" runat="server">
>>>>>>>>voi d Page_Load(Objec t sender, EventArgs e)
>>>>>>>>{
>>>>>>>>Myi d.Attributes.Ad d("xml:lang", "es");
>>>>>>>>Mes sage.InnerHtml = "<h4>The html control attributes collection contains:</h4>";
>>>>>>>>IEn umerator keys = Myid.Attributes .Keys.GetEnumer ator();
>>>>>>>>whi le (keys.MoveNext( ))
>>>>>>>>{
>>>>>>>>Str ing key = (String)keys.Cu rrent;
>>>>>>>>Mes sage.InnerHtml += key + "=" + Myid.Attributes[key] + "<br />";
>>>>>>>>}
>>>>>>>>}
>>>>>>>></script>
>>>>>>>><he ad id="Head1" runat="server">
>>>>>>>><ti tle>The html control attributes collection</title>
>>>>>>>></head>
>>>>>>>><bo dy>
>>>>>>>><fo rm id="Form1" runat="server">
>>>>>>>><h3 >HtmlControl Attribute Collection Example</h3>
>>>>>>>>< br />
>>>>>>>><sp an id="Message" enableviewstate ="false" runat="server" />
>>>>>>>></form>
>>>>>>>></body>
>>>>>>>></html>
>>>>>>>>----------------
>>>>>>>>>
>>>>>>>>I don't think it's a bug to have to add an attribute programmaticall y,
>>>>>>>>bec ause the runat="server" tag only *declares* the html control as a programmable control.
>>>>>>>>>
>>>>>>>>T o actually program it, you must use a script.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>Jua n T. Llibre, asp.net MVP
>>>>>>>>asp .net faq : http://asp.net.do/faq/
>>>>>>>>for os de asp.net, en español : http://asp.net.do/foros/
>>>>>>>>=== =============== =============== =====
>>>>>>>>"Le e C." <no*****@spamme r.comwrote in message news:e0******** ******@TK2MSFTN GP03.phx.gbl...
>>>>>>>>>Th anks, Juan.
>>>>>>>>> >
>>>>>>>>> I already added similar code to a page event in my masterpage code-beside.
>>>>>>>>> >
>>>>>>>>> elHtml.Attribut es.Add("xml:lan g", Resources.Globa lLang.ContentAu dienceLanguage)
>>>>>>>>> >
>>>>>>>>> To me, that is a temporary workaround. I still want to understand whether the "eating" of the attribute
>>>>>>>>> I
>>>>>>>>>or iginally
>>>>>>>>>po sted about is a bug, or if this is actually happening for a reason.
>>>>>>>>> >
>>>>>>>>>Co rdially,
>>>>>>>>>Le e
>>>>>>>>> >
>>>>>>>>> >
>>>>>>>>>"J uan T. Llibre" <no***********@ nowhere.comwrot e in message
>>>>>>>>>ne ws:%2********** ******@TK2MSFTN GP03.phx.gbl...
>>>>>>>>>>H i, Lee.
>>>>>>>>> >>
>>>>>>>>>>r e:
>>>>>>>>>>! <html runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>>>>>! no xml:lang attribute is rendered to the browser!
>>>>>>>>>>! Remove the runat="server", and, voila, the xml:lang attribute is rendered.
>>>>>>>>> >>
>>>>>>>>>>T ry this :
>>>>>>>>> >>
>>>>>>>>>>< html xmlns="http://www.w3.org/1999/xhtml" runat="server" id="someID">
>>>>>>>>> >>
>>>>>>>>>>< script runat="server">
>>>>>>>>>>s omeID.Attribute s("xml:lang") = "en-US"
>>>>>>>>> ></script>
>>>>>>>>> >>
>>>>>>>>> >>
>>>>>>>>> >>
>>>>>>>>>>J uan T. Llibre, asp.net MVP
>>>>>>>>>>a sp.net faq : http://asp.net.do/faq/
>>>>>>>>>>f oros de asp.net, en español : http://asp.net.do/foros/
>>>>>>>>>>= =============== =============== =======
>>>>>>>>> >>
>>>>>>>>>>" Lee C." <no****@spam.co mwrote in message news:O%******** ********@TK2MSF TNGP03.phx.gbl. ..
>>>>>>>>>>> >I think I have discovered a bug in ASP.NET, related to I18N.
>>>>>>>>>>> >
>>>>>>>>>>> In ASP.NET 3.5 I have to set runat="server" on the html element to use explicit expressions. It
>>>>>>>>>>> appears that
>>>>>>>>>>> ASP.NET
>>>>>>>>>>> eats the xml:lang attribute on the html element when it is set to runat="server".
>>>>>>>>>>> >
>>>>>>>>>>> Of course I want to replace the hardcoded "en-US" values with (resource) explicit expressions; but, for
>>>>>>>>>>> simplicity, try this:
>>>>>>>>>>> >
>>>>>>>>>>> <html runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>>>>>> >
>>>>>>>>>>> ...And you will find that no xml:lang attribute is rendered to the browser! Remove the runat="server",
>>>>>>>>>>> and,
>>>>>>>>>>> voila, the xml:lang attribute is rendered. :[
>>>>>>>>>>> >
>>>>>>>>>>> ...Any ideas?
>>>>>>>>>>> >
>>>>>>>>>>> Cordially,
>>>>>>>>>>> Lee

Jun 29 '08 #9
You say you understand, but you make statements that demonstrate otherwise.
You've been arguing against my "what" and "why" all along; yet, I'm the one
following modern best-practices (separating content from code)--which are
required for my scenario. If someone chooses to mix them, that's their
choice; but, it does not change the bug into a feature--regardless of your
position that it does.

At this point, I have no interest in your ASP.NET co-authoring.

Cordially,
Lee

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:uJ******** ******@TK2MSFTN GP04.phx.gbl...
re:
!You clearly don't understand

That "clearly" is doubted by me.

How many times have I told you that I *do* understand what you're saying
but that I'd like to see the bug response team's reply to your "bug
report" ?

How many times will you repeat that I "don't understand", when I do,
although I disagree with the premises you're putting forth ?

re:
!Are you really an ASP.NET MVP? (Classic ASP, maybe?)

The answer to that question is in my signature.
Maybe you haven't read any of the ASP.NET books I've co-authored ?

Good luck with the response to your bug report.
Please remember to post the result here.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Lee C." <no****@spam.co mwrote in message
news:eE******** ******@TK2MSFTN GP03.phx.gbl...
>Juan,

You clearly don't understand, or have not thought about *why* the ASP.NET
team gave us separate places for "design"/content (.aspx files) and
"procedure"/code (.aspx.vb). The ability to separate the 2 was a huge
feature for ASP.NET, from classic ASP.

Even though the particular content affected by the bug I found is not
*visible* Web browser content, it is content none-the-less. Thus, its
wiring belongs in the content file (.aspx)--not the code file (.aspx.vb).
Sure, I could throw in some classic ASP style, and put a script element
in my .aspx page to keep the wiring in the realm of the designer, but
that changes nothing, because it's still programming, which should be
done by programmers in the same place as every other line of programming
in my site: the .aspx.vb pages. Just as badly, it means I'm achieving my
I18N wiring in multiple ways, instead of being consistent.

By everything else, I meant all other I18N resource "wirings". (But, I
take pride in how "light" my .aspx.vb files are--and how clean my .aspx
files are, too.) You are obviously fine with having the designer(s) to
set up and manage *most* of the I18N wirings, *and* having programmers to
do some, too, (as they should not be doing) since bugs are not bugs for
you if there is a workaround that violates good design practices and
principles. I'm not fine with that.

Are you really an ASP.NET MVP? (Classic ASP, maybe?)

, Lee
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:ur******* *******@TK2MSFT NGP06.phx.gbl.. .
>>re:
!Setting it programmaticall y is an incorrect implementation
!when everything else on my page is set declaratively.

Is everything else on your pages set declaratively ?
Think about that for a second.

Why do we have inline scripts and code-behind, if "everything else is
set declaratively" ?

In any case, we've certainly had enough of the "I think that..." back
and forth.

Let's pause this discussion until the "bug" you reported is explained by
the VS Dev team, OK ?
I, definitely, want to see what their explanation is.

https://connect.microsoft.com/Visual...dbackID=353879

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============= =============== ==========
"Lee C." <no****@spam.co mwrote in message
news:eQ****** ********@TK2MSF TNGP05.phx.gbl. ..
Correct implementation? What do you mean by that?

I stated earlier on that I worked around it. It's still a bug.
Setting it programmaticall y is an incorrect implementation when
everything else on my page is set declaratively. Microsoft offered
declarativ e (explicit) expressions, and I want to use them--anywhere
and everywhere I choose in accordance with how they are stated to work.
When I find one that doesn't work, it's a bug; it's not a case of my
doing something incorrectly. I love Microsoft Visual Studio 2008; but,
I won't tolerate bugs, or suck them up as, "Oh, I must be doing it
wrong since it doesn't work--even though it should."

, Lee

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:%2***** ***********@TK2 MSFTNGP04.phx.g bl...
re:
!ASP.NET should make it easy for me--and, it does,
!but there is a bug in the implementation.
>
The fact that you *can* set xml:lang programmaticall y, and that you
*did* set it that way,
as I did, should tell you that it isn't much of a bug, but a question
of using the correct implementation.
>
But, again, please let us know what the reply to your bug report is.
>
>
>
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=========== =============== ============
"Lee C." <no****@spam.co mwrote in message
news:%2**** ************@TK 2MSFTNGP04.phx. gbl...
>Juan,
>>
>My use of language and culture in ASP.Net is a bit different than
>most. I have registered numerous country-code-specific domains
>(mysite.ca , mysite.co.uk, mysite.com.au, etc.), which resolve to a
>singular "ASP.Net Web Site". Nothing new there. However, I'm not
>doing the ASP.Net usual of letting the user agent (HTTP header
>'accept-language') determine which language visitors get; I have the
>country-code TLD drive it. Also, it's not just the language of my
>content that varies by cc TLD, it's the content, too; but, lang
>attribut es play a critical role in informing user agents (including
>search engine bots) for what "country" my content is aimed.
>>
>I have already found, first-hand, that the better of the major search
>engines use the cc TLD *and* the HTML lang/xml:lang to determine
>whether a domain's documents (mysite.com.au/my-document.aspx) should
>show up when a searcher searches with the 'Only from Australia'
>checkbox checked on Live.com, for example.
>>
>I'm not setting lang attributes for fun; I'm doing it to correct
>search engine results. ASP.NET should make it easy for me--and, it
>does, but there is a bug in the implementation.
>>
>I appreciate your interest and effort to help.
>>
>, Lee
>>
>>
>"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
>news:uB*** ***********@TK2 MSFTNGP03.phx.g bl...
>>re:
>>!versus the spirit of what we're trying to accomplish: telling
>>user agents who our
>>!intend ed audiences is, by language, as best we can...which is why
>>I'm *also*
>>!settin g lang in the HTTP headers and in page meta tags
>>>
>>What ? You don't set a language/culture in web.config, too ?
>>There's a use for overkill ! ( only kidding... )
>>>
>>I don't see too clearly the purpose of declaring a single language
>>for a web page.
>>>
>>I do see a use for declaring specific language attributes in a
>>*collecti on* of xml documents,
>>so that individual documents can be parsed for a particular language
>>content .
>>>
>>But, ymmv...
>>>
>>I'd still be interested in knowing what the reply is to your bug
>>report.
>>I bet you'll get back : "That's by design". <g>
>>>
>>Don't forget to let us all know what happens with that, OK ?
>>Thanks for an interesting discussion.
>>>
>>>
>>>
>>>
>>Juan T. Llibre, asp.net MVP
>>asp.net faq : http://asp.net.do/faq/
>>foros de asp.net, en español : http://asp.net.do/foros/
>>========= =============== ==============
>>"Lee C." <no****@spam.co mwrote in message
>>news:en** ***********@TK2 MSFTNGP05.phx.g bl...
>>>Juan,
>>>>
>>>In theory, I like your idea of investigating "the standard"; but,
>>>in practice it has serious problems, as it often does. First, you
>>>are referring to the XML standard, which is not as appropriate as
>>>HTML and XHTML standards. Second, none of them are crystal clear on
>>>best practices for I18N. There is a lot of *legal* (by the
>>>standard ) syntax, that makes no sense, or makes some sense without
>>>being clearly best. The W3C site often states something to the
>>>effect of, "some are doing this, some are doing that, on your own
>>>site, at least do something and only time will tell what is best."
>>>>
>>>Check out these fine examples, which mirror my syntax, on the W3C
>>>site.
>>>>
>>>Internat ionalization Best Practices: Specifying Language in XHTML &
>>>HTML Content
>>>http://www.w3.org/TR/i18n-html-tech-...0429.092928424
>>>>
>>>>
>>>Tutorial : Declaring Language in XHTML and HTML (Draft)
>>>http://www.w3.org/International/tuto...Slide0160.html
>>>>
>>>Juan, you wrote:
>>>>But, it seems to me that setting xml:lang for the html tag's
>>>>*attrib ute* values is unneeded, since they must
>>>>be in English, and they must be attributes set to a language
>>>>identif ier, as defined by IETF RFC 4646
>>>>(http://www.ietf.org/rfc/rfc4646.txt).
>>>>
>>>You're not setting it for "the tag's *attribute*", you're setting
>>>it for the *contents*, all contents, of the element (unless
>>>overridd en by a sub-setting), which makes perfect sense so that I
>>>don't have to set it individually on every child element--that is
>>>the power of a hierarchy! You seem to be focused on the technical,
>>>with some misunderstandin g, versus the spirit of what we're trying
>>>to accomplish: telling user agents who our intended audiences is,
>>>by language, as best we can...which is why I'm *also* setting lang
>>>in the HTTP headers and in page meta tags.
>>>>
>>>, Lee
>>>>
>>>>
>>>"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
>>>news:OY* *************@T K2MSFTNGP02.phx .gbl...
>>>>re:
>>>>!I found an MSDN document that explains why what I'm trying to
>>>>do should work
>>>>>
>>>>Lee,
>>>>>
>>>>From :
>>>>>
>>>>http://www.w3.org/TR/REC-xml/
>>>>>
>>>>"A special attribute named xml:lang may be inserted in documents
>>>>to specify the
>>>>languag e used in the contents and attribute values of any element
>>>>in an XML document."
>>>>>
>>>>If anything, I can see xml:lang being declared for specific
>>>>conte nt values, for example :
>>>>>
>>>><p xml:lang="en-GB">What colour is it?</p>
>>>><p xml:lang="en-US">What color is it?</p>
>>>>>
>>>>Then, an xml parser could identify regional US and British
>>>>spellin gs but, given that *all* the attribute values
>>>>must be in English in an html doc, what would be the purpose of
>>>>declari ng xml:lang for the html markup ?
>>>>>
>>>>A similar explanation is given here :
>>>>http://www.simonstl.com/xmlprim/xmlupdate/atts.html
>>>>>
>>>>---000---
>>>><SECTIO N>
>>>><DESCRI PTION xml:lang="en">
>>>>Caesa r begins by describing the geography of Gaul.
>>>></DESCRIPTION>
>>>><QUOT E xml:lang="la">
>>>>Galli a est omnis divisa in partes tres, quarum unam incolunt
>>>>Belga e,
>>>>aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli
>>>>appella ntur.
>>>></QUOTE>
>>>>---000---
>>>>>
>>>>That' s perfectly good usage for xml:lang, as a parser could
>>>>selecti vely identify content in different languages.
>>>>>
>>>>But, it seems to me that setting xml:lang for the html tag's
>>>>*attrib ute* values is unneeded, since they must
>>>>be in English, and they must be attributes set to a language
>>>>identif ier, as defined by IETF RFC 4646
>>>>(http://www.ietf.org/rfc/rfc4646.txt).
>>>>>
>>>>So, I think that requisite pretty well establishes the futility
>>>>of setting xml:lang for all the attributes in an html document.
>>>>>
>>>>If anything, it seems that the xml:lang attribute is included in
>>>>the
>>>>html server tag for compatibility purposes, or perhaps out of
>>>>ignoran ce.
>>>>>
>>>>If there's a need to identify that the *contents* of a particular
>>>>marku p tag are in a
>>>>specifi c language, that identification can be included in the tag
>>>>itsel f, for example :
>>>>>
>>>><div lang="MX-es" xml:lang="MX-es">
>>>>Algo de contenido en español mejicano.
>>>></div>
>>>>>
>>>>That makes a lot more sense than setting xml:lang for the
>>>>attribu te values in the html tag.
>>>>>
>>>>>
>>>>>
>>>>Juan T. Llibre, asp.net MVP
>>>>asp.n et faq : http://asp.net.do/faq/
>>>>foros de asp.net, en español : http://asp.net.do/foros/
>>>>======= =============== =============== =
>>>>"Lee C." <no*****@spamme r.comwrote in message
>>>>news:%2 *************** *@TK2MSFTNGP04. phx.gbl...
>>>>>>I found an MSDN document that explains why what I'm trying to do
>>>>>>shoul d work.
>>>>>>
>>>>>ASP.NE T Web Server Controls Overview
>>>>>http://msdn.microsoft.com/en-us/library/zsyt68f1.aspx
>>>>>>
>>>>>Note the distinction between HTML Server Controls and Web Server
>>>>>Contro ls in the document. Also, note the explanation
>>>>>of "pass-through" attributes for HTML Server Controls.
>>>>>>
>>>>>Two quotes that sum it up:
>>>>> 1. Any HTML element on a page can be converted to an HTML
>>>>>serv er control by adding the attribute runat="server".
>>>>> 2. You can add any attributes you need to an HTML server
>>>>>contro l and the page framework will render them without
>>>>>any change in functionality.
>>>>>>
>>>>>, Lee
>>>>>>
>>>>>"Lee C." <no*****@spamme r.comwrote in message
>>>>>news:O e************** @TK2MSFTNGP03.p hx.gbl...
>>>>>>Jua n,
>>>>>>>
>>>>>>I appreciate your trying to help, but you're wrong, and you are
>>>>>>the one who is confused. :]
>>>>>>>
>>>>>>I am *not* disputing that when inserted programmaticall y, the
>>>>>>xml:l ang attribute renders to the browser. I did just
>>>>>>tha t as a work around (right after I discovered this bug); but,
>>>>>>I should not have to.
>>>>>>>
>>>>>>I am *not* confusing html attributes with runat="server"
>>>>>>attri butes, as you call them. Using your logic, none of the
>>>>>>decla rative (html) attributes should render to the browser after
>>>>>>I add the runat="server" in ASP.NET; yet all of them
>>>>>>(xmln s, lang, and dir) do--except xml:lang.
>>>>>>>
>>>>>>I started with an html element with 4 attributes (xmlns, lang,
>>>>>>xml:l ang, and dir) all set declaratively. With *no*
>>>>>>5th attribute of runat="server", all 4 attributes render. If I
>>>>>>add the 5th attribute of runat="server", which does
>>>>>>not and should not render, I no longer get all 4 attributes that
>>>>>>shoul d render (xmlns, lang, xml:lang, and dir), I
>>>>>>onl y get 3 (xmlns, lang, and dir). My logic says I should get
>>>>>>4, your says I should get 3? It would be 4 or 0, and
>>>>>>4 is right. Not 0...and not 3.
>>>>>>>
>>>>>>Whe n I add runat="server", it does not magically make the
>>>>>>xml:l ang attribute a server-side attribute, while keeping
>>>>>>the other three attributes as "html" attributes. All four are
>>>>>>sti ll "html" attributes--which should render.
>>>>>>>
>>>>>>I think the simplification of my example may be confusing you.
>>>>>>It is odd that, in my example, I set runat="server"
>>>>>>but do not have any server-side attributes. (I have all 4 as
>>>>>>liter al strings, for simplicity of an example.) Well,
>>>>>>in my real-world use, I do have server-side attributes, which I
>>>>>>wan t set declaratively (no code-beside and no
>>>>>>scrip t). I have:
>>>>>>>
>>>>>><ht ml runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>>>>> xml:lang="<%$ Resources:Globa lLang, ContentAudience Language
>>>>>>%>"
>>>>>> lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
>>>>>> dir="ltr">
>>>>>>>
>>>>>>Bot h of those declarative explicit localization expressions
>>>>>>shoul d work without my having to write any more
>>>>>>"proc edural" (code-beside) code or script. It actually does
>>>>>>wor k fine for the lang attribute--as it should; but not
>>>>>>for the xml:lang attribute--***which is a bug***.
>>>>>>>
>>>>>>, Lee
>>>>>>>
>>>>>>"Ju an T. Llibre" <no***********@ nowhere.comwrot e in message
>>>>>>news: u0************* *@TK2MSFTNGP04. phx.gbl...
>>>>>>>re :
>>>>>>>!I think you are misunderstandin g, Juan.
>>>>>>>>
>>>>>>>Well , I think you are misunderstandin g *me*.
>>>>>>>>
>>>>>>>re :
>>>>>>>!I had the xml:lang attribute in the html tag
>>>>>>>(dec laratively), like this:
>>>>>>>>... and it renders to the browser, as it should.
>>>>>>>>
>>>>>>>Ye s, because it's standard html.
>>>>>>>>
>>>>>>>re :
>>>>>>>!I f I simply add runat="server"
>>>>>>>>
>>>>>>>Th at declares the control to run server side.
>>>>>>>>
>>>>>>>Fo r any attribute to be programmed server-side you need a
>>>>>>>scri pt,
>>>>>>>ju st as you need a script to modify any server control's
>>>>>>>attr ibutes.
>>>>>>>>
>>>>>>>Di d you run the sample page I sent ?
>>>>>>>>
>>>>>>>It iterates throught the attributes for the html server
>>>>>>>cont rol,
>>>>>>>an d shows that the xml:lang attribute *is* added
>>>>>>>prog rammatically.
>>>>>>>>
>>>>>>>re :
>>>>>>>!I f I simply add runat="server", leaving in the xml:lang
>>>>>>>attr ibute that
>>>>>>>!ren ders without runat="server", all of the (declarative)
>>>>>>>attr ibutes are
>>>>>>>!ren dered to the browser--except the xml:lang attribute!
>>>>>>>Th at is a bug.
>>>>>>>>
>>>>>>>I think you're confusing html attributes with runat="server"
>>>>>>>attr ibutes.
>>>>>>>>
>>>>>>>Ht ml attributes can be inserted in normal html.
>>>>>>>Serv er-side attributes must be inserted in code.
>>>>>>>>
>>>>>>>Mayb e I'm not explaining this as well as I should.
>>>>>>>Tr y to get someone else's opinion on this matter, if you don't
>>>>>>>acce pt mine.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>Ju an T. Llibre, asp.net MVP
>>>>>>>asp. net faq : http://asp.net.do/faq/
>>>>>>>foro s de asp.net, en español : http://asp.net.do/foros/
>>>>>>>==== =============== =============== ====
>>>>>>>"L ee C." <no*****@spamme r.comwrote in message
>>>>>>>news :en************ **@TK2MSFTNGP04 .phx.gbl...
>>>>>>>>> I think you are misunderstandin g, Juan. I had the xml:lang
>>>>>>>>>at tribute in the html tag (declaratively) , like this:
>>>>>>>>>
>>>>>>>><ht ml xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"
>>>>>>>>lan g="en-US" dir="ltr">
>>>>>>>>>
>>>>>>>>... and it renders to the browser, as it should.
>>>>>>>>>
>>>>>>>>I f I simply add runat="server", leaving in the xml:lang
>>>>>>>>att ribute that renders without runat="server", all of the
>>>>>>>>(de clarative) attributes are rendered to the browser--except
>>>>>>>>t he xml:lang attribute! That is a bug.
>>>>>>>>>
>>>>>>>><ht ml runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>>>>>>>xml :lang="en-US" lang="en-US" dir="ltr">
>>>>>>>>>
>>>>>>>>Cor dially,
>>>>>>>>L ee
>>>>>>>>>
>>>>>>>>>
>>>>>>>>"Ju an T. Llibre" <no***********@ nowhere.comwrot e in message
>>>>>>>>new s:ey*********** ***@TK2MSFTNGP0 2.phx.gbl...
>>>>>>>>>He re's a full example which shows that the xml:lang attribute
>>>>>>>>> is added programmaticall y :
>>>>>>>>> >
>>>>>>>>>at tributes.aspx:
>>>>>>>>>----------------------
>>>>>>>>><% @ Page Language="C#" AutoEventWireup ="True" %>
>>>>>>>>><h tml xmlns="http://www.w3.org/1999/xhtml" runat="server"
>>>>>>>>>id ="Myid" >
>>>>>>>>><s cript language="C#" runat="server">
>>>>>>>>>vo id Page_Load(Objec t sender, EventArgs e)
>>>>>>>>> {
>>>>>>>>>My id.Attributes.A dd("xml:lang", "es");
>>>>>>>>>Me ssage.InnerHtml = "<h4>The html control attributes
>>>>>>>>>co llection contains:</h4>";
>>>>>>>>>IE numerator keys = Myid.Attributes .Keys.GetEnumer ator();
>>>>>>>>>wh ile (keys.MoveNext( ))
>>>>>>>>> {
>>>>>>>>>St ring key = (String)keys.Cu rrent;
>>>>>>>>>Me ssage.InnerHtml += key + "=" + Myid.Attributes[key] + "<br
>>>>>>>>>/>";
>>>>>>>>> }
>>>>>>>>> }
>>>>>>>>> </script>
>>>>>>>>><h ead id="Head1" runat="server">
>>>>>>>>><t itle>The html control attributes collection</title>
>>>>>>>>> </head>
>>>>>>>>><b ody>
>>>>>>>>><f orm id="Form1" runat="server">
>>>>>>>>><h 3>HtmlControl Attribute Collection Example</h3>
>>>>>>>>><b r />
>>>>>>>>><s pan id="Message" enableviewstate ="false" runat="server" />
>>>>>>>>> </form>
>>>>>>>>> </body>
>>>>>>>>> </html>
>>>>>>>>>----------------
>>>>>>>>> >
>>>>>>>>> I don't think it's a bug to have to add an attribute
>>>>>>>>>pr ogrammatically,
>>>>>>>>>be cause the runat="server" tag only *declares* the html
>>>>>>>>>co ntrol as a programmable control.
>>>>>>>>> >
>>>>>>>>> To actually program it, you must use a script.
>>>>>>>>> >
>>>>>>>>> >
>>>>>>>>> >
>>>>>>>>> >
>>>>>>>>>Ju an T. Llibre, asp.net MVP
>>>>>>>>>as p.net faq : http://asp.net.do/faq/
>>>>>>>>>fo ros de asp.net, en español : http://asp.net.do/foros/
>>>>>>>>>== =============== =============== ======
>>>>>>>>>"L ee C." <no*****@spamme r.comwrote in message
>>>>>>>>>ne ws:e0********** ****@TK2MSFTNGP 03.phx.gbl...
>>>>>>>>>>T hanks, Juan.
>>>>>>>>> >>
>>>>>>>>> >I already added similar code to a page event in my
>>>>>>>>>>m asterpage code-beside.
>>>>>>>>> >>
>>>>>>>>> > elHtml.Attribut es.Add("xml:lan g",
>>>>>>>>>>R esources.Global Lang.ContentAud ienceLanguage)
>>>>>>>>> >>
>>>>>>>>>>T o me, that is a temporary workaround. I still want to
>>>>>>>>>>u nderstand whether the "eating" of the attribute I
>>>>>>>>>>o riginally
>>>>>>>>>>p osted about is a bug, or if this is actually happening for
>>>>>>>>> >a reason.
>>>>>>>>> >>
>>>>>>>>>>C ordially,
>>>>>>>>>>L ee
>>>>>>>>> >>
>>>>>>>>> >>
>>>>>>>>>>" Juan T. Llibre" <no***********@ nowhere.comwrot e in
>>>>>>>>>>m essage news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>>>>>>>>>>> Hi, Lee.
>>>>>>>>>>> >
>>>>>>>>>>> re:
>>>>>>>>>>> !<html runat="server"
>>>>>>>>>>> xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"
>>>>>>>>>>> lang="en-US" dir="ltr">
>>>>>>>>>>> !no xml:lang attribute is rendered to the browser!
>>>>>>>>>>> !Remove the runat="server", and, voila, the xml:lang
>>>>>>>>>>> attribute is rendered.
>>>>>>>>>>> >
>>>>>>>>>>> Try this :
>>>>>>>>>>> >
>>>>>>>>>>> <html xmlns="http://www.w3.org/1999/xhtml" runat="server"
>>>>>>>>>>> id="someID">
>>>>>>>>>>> >
>>>>>>>>>>> <script runat="server">
>>>>>>>>>>> someID.Attribut es("xml:lang") = "en-US"
>>>>>>>>>>> </script>
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> >
>>>>>>>>>>> Juan T. Llibre, asp.net MVP
>>>>>>>>>>> asp.net faq : http://asp.net.do/faq/
>>>>>>>>>>> foros de asp.net, en español : http://asp.net.do/foros/
>>>>>>>>>>> =============== =============== ========
>>>>>>>>>>> >
>>>>>>>>>>> "Lee C." <no****@spam.co mwrote in message
>>>>>>>>>>> news:O%******** ********@TK2MSF TNGP03.phx.gbl. ..
>>>>>>>>>>> >>I think I have discovered a bug in ASP.NET, related to
>>>>>>>>>>> >>I18N.
>>>>>>>>>>> >>
>>>>>>>>>>> >In ASP.NET 3.5 I have to set runat="server" on the html
>>>>>>>>>>> >element to use explicit expressions. It appears that
>>>>>>>>>>> >ASP.NET
>>>>>>>>>>> >eats the xml:lang attribute on the html element when it is
>>>>>>>>>>> >set to runat="server".
>>>>>>>>>>> >>
>>>>>>>>>>> >Of course I want to replace the hardcoded "en-US" values
>>>>>>>>>>> >with (resource) explicit expressions; but, for simplicity,
>>>>>>>>>>> >try this:
>>>>>>>>>>> >>
>>>>>>>>>>> ><html runat="server" xmlns="http://www.w3.org/1999/xhtml"
>>>>>>>>>>> >xml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>>>>>> >>
>>>>>>>>>>> >...And you will find that no xml:lang attribute is
>>>>>>>>>>> >rendered to the browser! Remove the runat="server", and,
>>>>>>>>>>> >voila, the xml:lang attribute is rendered. :[
>>>>>>>>>>> >>
>>>>>>>>>>> >...Any ideas?
>>>>>>>>>>> >>
>>>>>>>>>>> >Cordially,
>>>>>>>>>>> >Lee


Jun 30 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2016
by: Brian Kelley | last post by:
I have been using gettext and various utilities to provide internationalization for a wxPython application and have not really been liking the process. Essentially it uses a macro-style notation to indicate which strings should be internationalized. Essentially, everything looks like this _("STRING") A good description of this system is located here http://wiki.wxpython.org/index.cgi/Internationalization
19
2172
by: Johannes Nix | last post by:
Hello, yesterday I met a cute person (after my dance class) who told me about an interesting experiment regarding cognition. People were told to read a typed text; However, in every word in the text, only the first and the last letter were in the right place. The other letters had their positions changed in an arbitrary manner. The surprising result, I was told, was that people can read this mixed-up text fairly well. Because I am a...
12
4086
by: Chris Mullins | last post by:
I'm implementing RFC 3491 in .NET, and running into a strange issue. Step 1 of RFC 3491 is performing a set of mappings dicated by tables B.1 and B.2. I'm having trouble with the following mappings though, and it seems like a shortcoming of the .NET framework: When I see Unicode value 0x10400, I'm supposed to map it to value 0x10428. This list goes on (the left colulmn is the existing value, the right column
9
2497
by: Developer | last post by:
Hello, I have an xml retrieved by a client running Japanese windows from a server running Japanese windows. I can view this document in IE.6. (The Opera browser, though, reports the error.) However, when I try to parse the xml with a sax reader I'm implementing, I get the message "A name contained an invalid character" in the fatalError() method of my ISAXErrorHandler.
6
2787
by: Zlatko Matiæ | last post by:
What is the easiest way to accomplish internationalization in Access application?
2
1699
by: Internationalization | last post by:
COMSYS Globalization Practice is looking for a C#/.NET Internationalization consultant in OR. Can you please contact me if you are interested or else know someone who would be interested. It will be 4-6 weeks assignment. Thank you, Rhea Tanaka COMSYS Globalization Practice rtanaka@comsys.com
0
1112
by: Pablo Jose Almeida da Guia | last post by:
Well.. ...I am using some resource files to make the internationalization of a ASP.NET application. I created a project and three resource files. ------- resource files ------- /strings.txt /en-US/strings.en-US.txt /pt-BR/strings.pt-BR.txt ------- resource files -------
3
1982
by: Jules | last post by:
i'm working with translators that just want to translate "web pages" and not deal with resource files. i'd like to have a file structure that looks sort of like this: / <- root directory where all .cs files live /en-US/ <- english specific directory which contains aspx and ascx files only /jp-JP/ <- japaneses specific directory which contains aspx and ascx files only
3
1848
by: Pieter | last post by:
Hi, What's the commonly used way to do internationalization of the text in MessageBoxes? Thanks a lot in advance, Pieter
2
431
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Internationalization and Multinationalization in javascript. ----------------------------------------------------------------------- Internationalization means using one form which is both acceptable and understood everywhere. By default, javascript has no such features; but if an international standard exists it can be coded for. For example, there...
0
8312
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8504
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8606
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6169
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4159
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1622
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.