Re: ASP.NET Internationalization bug?



re:
!> I think you are misunderstanding, Juan.

Well, I think you are misunderstanding *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 programmatically.

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.spam@xxxxxxxxxxx> wrote in message news:enam1gH2IHA.4552@xxxxxxxxxxxxxxxxxxxxxxx
I think you are misunderstanding, 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" <nomailreplies@xxxxxxxxxxx> wrote in message news:eyrwjUH2IHA.3920@xxxxxxxxxxxxxxxxxxxxxxx
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: Change __VIEWSTATE to something else
    ... HTML working group: ... Juan T. Llibre, asp.net MVP ... Sure, but that's the spec for HTML 4.01, not the spec for XHTML. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: ASP.NET Internationalization bug?
    ... Juan. ... html tag, like this: ... ....and it renders to the browser, ... That is a bug. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Converting ASP.NET Page from VB to C#
    ... Great links Juan - I've been looking for some good converters! ... one I've used so far is the demo of Instant C#: VB to C# Converter from ... Stick your code into them (just the code, not the HTML) ... Juan T. Llibre, asp.net MVP ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: ASP.NET Internationalization bug?
    ... no xml:lang attribute is rendered to the browser! ... Juan T. Llibre, asp.net MVP ... In ASP.NET 3.5 I have to set runat="server" on the html element to use explicit expressions. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How to do a post back when user press enter.
    ... It is hosted on a web server, ... the client browser, which is designed to read and interpret HTML. ... UI, via the event handler. ...
    (microsoft.public.dotnet.framework.aspnet)