Re: ASP.NET Internationalization bug?



Here's a full example which shows that the xml:lang attribute is added programmatically :

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(Object sender, EventArgs e)
{
Myid.Attributes.Add("xml:lang", "es");
Message.InnerHtml = "<h4>The html control attributes collection contains:</h4>";
IEnumerator keys = Myid.Attributes.Keys.GetEnumerator();
while (keys.MoveNext())
{
String key = (String)keys.Current;
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>HtmlControl 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 programmatically,
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.spam@xxxxxxxxxxx> wrote in message news:e0rLaPG2IHA.4772@xxxxxxxxxxxxxxxxxxxxxxx
Thanks, Juan.

I already added similar code to a page event in my masterpage code-beside.

elHtml.Attributes.Add("xml:lang", Resources.GlobalLang.ContentAudienceLanguage)

To me, that is a temporary workaround. I still want to understand whether the "eating" of the attribute I originally
posted about is a bug, or if this is actually happening for a reason.

Cordially,
Lee


"Juan T. Llibre" <nomailreplies@xxxxxxxxxxx> wrote in message news:%23gBUqSC2IHA.4772@xxxxxxxxxxxxxxxxxxxxxxx
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.Attributes("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." <nomail@xxxxxxxx> wrote in message news:O%23KsAQA2IHA.4572@xxxxxxxxxxxxxxxxxxxxxxx
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










.



Relevant Pages

  • Re: Proper coding? (JS newbie)
    ... Document content looks like HTML 4.01 Transitional ... also in the FAQ. ... array; one fewer thing to change if another button is added. ... Use W3C standard ...
    (microsoft.public.scripting.jscript)
  • Re: Plain text file on web server, questions please...
    ... I like to keep a single copy of this FAQ and then ... week and the FAQ is online all the time. ... it has no HTML tags in it to designate URL links and one ... a utility that would do this or can it be done with a shell script ...
    (alt.os.linux)
  • Re: COBOL FAQ *moved*
    ... I just accessed it with Firefox and had no problems with seeing it. ... FAQ for people who want a COBOL tutor (without being told to do their own ... using the tool that DW provides to 'Clean up WORD HTML'. ... I intend to keep ...
    (comp.lang.cobol)
  • Re: FAQ Topic - How can I create a Date from a String? (2009-10-05)
    ... once in String. ... is no example in the FAQ. ... ISO8601 format. ... HTML 5 deviates from ISO8601, in that it allows the year to be any ...
    (comp.lang.javascript)
  • Re: Proper coding? (JS newbie)
    ... Document content looks like HTML 4.01 Transitional ... A 99-lb dog, minor nip, shows $54.67000000000001 - FAQ again. ... Your hbh dbh obh are used as Booleans but given integer values; ...
    (microsoft.public.scripting.jscript)

Loading