ASP.NET 2.0 Beta and Localization

O

Olivier Matrot

I encounter a problem with Localization features in ASP.NET 2.0.
Is seems that the framework is not able to manage neutral cultures such as
'fr', or 'de'. Those are the culture sent by default from a french or German
Internet Explorer in France or Germany.

There is a runtime error "System.NotSupportedException: Culture "fr" is a
neutral culture. It can not be used in formatting and parsing and therefore
cannot be set as the thread's current culture."

However, this happens only the first time a page in the site is accessed.
Other hits are processed correctly...

TIA.
 
J

Juan T. Llibre

Try using "fr-FR" and "de-DE", if you're configuring culture and uiCulture.

If you're using resources, remember that they now go
in the App_LocalResources directory.



Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
 
O

Olivier Matrot

In ASP.NET 2.0 the thread culture is automatically set to the culture
request found in the headers sent by Internet Explorer.
I'm pretty sure that this will be corrected in the final release, but in the
meantime, I must found a solution to this particular problem.

Anyway, Internet Explorer has no way to specify 'fr-FR' in the language
preferences, and I do not want my customers to make such a change because of
a restriction in the current Framework release. Firefox have the language
'fr-FR' available.

Here is the call stack :
System.Globalization.CultureInfo.CheckNeutral(CultureInfo culture) +2722547
System.Threading.Thread.set_CurrentCulture(CultureInfo value) +42
System.Web.HttpApplication.SetCulture(Boolean useAppCulture) +3438992
System.Web.HttpApplication.ProcessSpecialRequest(HttpContext context,
MethodInfo method, Int32 paramCount, Object eventSource, EventArgs
eventArgs, HttpSessionState session) +187
 
J

Juan T. Llibre

That is not a "problem" nor a "restriction"
and there's nothing to fix. It's a feature.

You have a number of misconceptions which
would be too extensive to deal with in a short post.

Please review this :
http://beta.asp.net/QUICKSTART/aspnet/doc/localization/culture.aspx#ielanguage

In ASP.NET 2.0, setting your Page culture to :

<%@ Page Culture="auto:fr-FR" %>

should fix your problem.



Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
 
O

Olivier Matrot

I've modified all my pages as you suggested.
The problem is not fixed.

I forgot to say that the exception is thrown before any of the function
available in Global.asax.cs are reached.
 
S

Steven Cheng[MSFT]

Hi Olivier,

I've just performed the test on my local ASP.NET 2.0 beta2 environment,
seems I'm not able to repro the behavior when using a english version's
IE(set the default browser language to fr ). As you also mentioned that
the exception happens at the intial request to the website and before event
in Global.asax get fired, I'm wondering that it's a parsing error occur
during the dynamica compilation stage. Have you checked your global
resource or any other global component (which will be compiled at initial
time) to see whether you've set any neutral culture as the "Culture"
attribute? Anyway, what make me strange is that the runtime should always
convert neutral culture to specific culture internally. So if you did be
able to repro the problem on the latest beta2 or CTP, I suggest you try
submitting a fix request as Juan has mentioned.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)







--------------------
| From: "Juan T. Llibre" <[email protected]>
| References: <#[email protected]>
<[email protected]>
<OM#[email protected]>
<#y#[email protected]>
<[email protected]>
| Subject: Re: ASP.NET 2.0 Beta and Localization
| Date: Tue, 16 Aug 2005 12:15:50 -0400
| Lines: 117
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| X-RFC2646: Format=Flowed; Response
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 222stb33.codetel.net.do 64.32.114.222
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:118329
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Very strange, indeed.
|
| Have you considered bugging the behavior at
| http://lab.msdn.microsoft.com/productfeedback/ ?
|
| You'll need a Passport account to file a bug there.
|
| Thanks !
|
|
|
|
| Juan T. Llibre
| ASP.NET MVP
| http://asp.net.do/foros/
| Foros de ASP.NET en Español
| Ven, y hablemos de ASP.NET...
| ======================
|
| | > I've modified all my pages as you suggested.
| > The problem is not fixed.
| >
| > I forgot to say that the exception is thrown before any of the function
available in
| > Global.asax.cs are reached.
| >
| > | >> That is not a "problem" nor a "restriction"
| >> and there's nothing to fix. It's a feature.
| >>
| >> You have a number of misconceptions which
| >> would be too extensive to deal with in a short post.
| >>
| >> Please review this :
| >>
http://beta.asp.net/QUICKSTART/aspnet/doc/localization/culture.aspx#ielangua
ge
| >>
| >> In ASP.NET 2.0, setting your Page culture to :
| >>
| >> <%@ Page Culture="auto:fr-FR" %>
| >>
| >> should fix your problem.
| >>
| >>
| >>
| >> Juan T. Llibre
| >> ASP.NET MVP
| >> http://asp.net.do/foros/
| >> Foros de ASP.NET en Español
| >> Ven, y hablemos de ASP.NET...
| >> ======================
| >>
| >> | >>> In ASP.NET 2.0 the thread culture is automatically set to the culture
request found in
| >>> the headers sent by Internet Explorer.
| >>> I'm pretty sure that this will be corrected in the final release, but
in the meantime,
| >>> I must found a solution to this particular problem.
| >>>
| >>> Anyway, Internet Explorer has no way to specify 'fr-FR' in the
language preferences,
| >>> and I do not want my customers to make such a change because of a
restriction in the
| >>> current Framework release. Firefox have the language 'fr-FR'
available.
| >>>
| >>> Here is the call stack :
| >>> System.Globalization.CultureInfo.CheckNeutral(CultureInfo culture)
+2722547
| >>> System.Threading.Thread.set_CurrentCulture(CultureInfo value) +42
| >>> System.Web.HttpApplication.SetCulture(Boolean useAppCulture)
+3438992
| >>> System.Web.HttpApplication.ProcessSpecialRequest(HttpContext
context, MethodInfo
| >>> method, Int32 paramCount, Object eventSource, EventArgs eventArgs,
HttpSessionState
| >>> session) +187
| >>>
| >>>
| >>>
| >>>
| >>>
| >>> | >>>> Try using "fr-FR" and "de-DE", if you're configuring culture and
uiCulture.
| >>>>
| >>>> If you're using resources, remember that they now go
| >>>> in the App_LocalResources directory.
| >>>>
| >>>>
| >>>>
| >>>> Juan T. Llibre
| >>>> ASP.NET MVP
| >>>> http://asp.net.do/foros/
| >>>> Foros de ASP.NET en Español
| >>>> Ven, y hablemos de ASP.NET...
| >>>> ======================
| >>>>
| >>>> | >>>>>I encounter a problem with Localization features in ASP.NET 2.0.
| >>>>> Is seems that the framework is not able to manage neutral cultures
such as 'fr', or
| >>>>> 'de'. Those are the culture sent by default from a french or German
Internet
| >>>>> Explorer in France or Germany.
| >>>>>
| >>>>> There is a runtime error "System.NotSupportedException: Culture
"fr" is a neutral
| >>>>> culture. It can not be used in formatting and parsing and therefore
cannot be set as
| >>>>> the thread's current culture."
| >>>>>
| >>>>> However, this happens only the first time a page in the site is
accessed. Other hits
| >>>>> are processed correctly...
| >>>>>
| >>>>> TIA.
| >>>>
| >>>>
| >>>
| >>>
| >>
| >>
| >
| >
|
|
|
 
O

Olivier Matrot

Found the problem.
The Globalization section in web.config has culture and uiCulture set to
"auto". Switching to "fr-FR" solved the problem.
 
S

Steven Cheng[MSFT]

Glad that you've found the cause Olivier,

If there're any further things or questions we can help, please always feel
free to post here.

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Olivier Matrot" <[email protected]>
| References: <#[email protected]>
<[email protected]>
<OM#[email protected]>
<#y#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: ASP.NET 2.0 Beta and Localization
| Date: Wed, 17 Aug 2005 09:50:43 +0200
| Lines: 207
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: reverse.completel.net 213.30.138.178
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:118508
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Found the problem.
| The Globalization section in web.config has culture and uiCulture set to
| "auto". Switching to "fr-FR" solved the problem.
|
|
| | > Hi Olivier,
| >
| > I've just performed the test on my local ASP.NET 2.0 beta2 environment,
| > seems I'm not able to repro the behavior when using a english version's
| > IE(set the default browser language to fr ). As you also mentioned that
| > the exception happens at the intial request to the website and before
| > event
| > in Global.asax get fired, I'm wondering that it's a parsing error occur
| > during the dynamica compilation stage. Have you checked your global
| > resource or any other global component (which will be compiled at
initial
| > time) to see whether you've set any neutral culture as the "Culture"
| > attribute? Anyway, what make me strange is that the runtime should
| > always
| > convert neutral culture to specific culture internally. So if you did be
| > able to repro the problem on the latest beta2 or CTP, I suggest you try
| > submitting a fix request as Juan has mentioned.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| >
| >
| >
| > --------------------
| > | From: "Juan T. Llibre" <[email protected]>
| > | References: <#[email protected]>
| > <[email protected]>
| > <OM#[email protected]>
| > <#y#[email protected]>
| > <[email protected]>
| > | Subject: Re: ASP.NET 2.0 Beta and Localization
| > | Date: Tue, 16 Aug 2005 12:15:50 -0400
| > | Lines: 117
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| > | X-RFC2646: Format=Flowed; Response
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: 222stb33.codetel.net.do 64.32.114.222
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:118329
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Very strange, indeed.
| > |
| > | Have you considered bugging the behavior at
| > | http://lab.msdn.microsoft.com/productfeedback/ ?
| > |
| > | You'll need a Passport account to file a bug there.
| > |
| > | Thanks !
| > |
| > |
| > |
| > |
| > | Juan T. Llibre
| > | ASP.NET MVP
| > | http://asp.net.do/foros/
| > | Foros de ASP.NET en Español
| > | Ven, y hablemos de ASP.NET...
| > | ======================
| > |
| > | | > | > I've modified all my pages as you suggested.
| > | > The problem is not fixed.
| > | >
| > | > I forgot to say that the exception is thrown before any of the
| > function
| > available in
| > | > Global.asax.cs are reached.
| > | >
| > | > | > | >> That is not a "problem" nor a "restriction"
| > | >> and there's nothing to fix. It's a feature.
| > | >>
| > | >> You have a number of misconceptions which
| > | >> would be too extensive to deal with in a short post.
| > | >>
| > | >> Please review this :
| > | >>
| >
http://beta.asp.net/QUICKSTART/aspnet/doc/localization/culture.aspx#ielangua
| > ge
| > | >>
| > | >> In ASP.NET 2.0, setting your Page culture to :
| > | >>
| > | >> <%@ Page Culture="auto:fr-FR" %>
| > | >>
| > | >> should fix your problem.
| > | >>
| > | >>
| > | >>
| > | >> Juan T. Llibre
| > | >> ASP.NET MVP
| > | >> http://asp.net.do/foros/
| > | >> Foros de ASP.NET en Español
| > | >> Ven, y hablemos de ASP.NET...
| > | >> ======================
| > | >>
message
| > | >> | > | >>> In ASP.NET 2.0 the thread culture is automatically set to the
| > culture
| > request found in
| > | >>> the headers sent by Internet Explorer.
| > | >>> I'm pretty sure that this will be corrected in the final release,
| > but
| > in the meantime,
| > | >>> I must found a solution to this particular problem.
| > | >>>
| > | >>> Anyway, Internet Explorer has no way to specify 'fr-FR' in the
| > language preferences,
| > | >>> and I do not want my customers to make such a change because of a
| > restriction in the
| > | >>> current Framework release. Firefox have the language 'fr-FR'
| > available.
| > | >>>
| > | >>> Here is the call stack :
| > | >>> System.Globalization.CultureInfo.CheckNeutral(CultureInfo culture)
| > +2722547
| > | >>> System.Threading.Thread.set_CurrentCulture(CultureInfo value)
+42
| > | >>> System.Web.HttpApplication.SetCulture(Boolean useAppCulture)
| > +3438992
| > | >>> System.Web.HttpApplication.ProcessSpecialRequest(HttpContext
| > context, MethodInfo
| > | >>> method, Int32 paramCount, Object eventSource, EventArgs eventArgs,
| > HttpSessionState
| > | >>> session) +187
| > | >>>
| > | >>>
| > | >>>
| > | >>>
| > | >>>
| > | >>> | > | >>>> Try using "fr-FR" and "de-DE", if you're configuring culture and
| > uiCulture.
| > | >>>>
| > | >>>> If you're using resources, remember that they now go
| > | >>>> in the App_LocalResources directory.
| > | >>>>
| > | >>>>
| > | >>>>
| > | >>>> Juan T. Llibre
| > | >>>> ASP.NET MVP
| > | >>>> http://asp.net.do/foros/
| > | >>>> Foros de ASP.NET en Español
| > | >>>> Ven, y hablemos de ASP.NET...
| > | >>>> ======================
| > | >>>>
| > message
| > | >>>> | > | >>>>>I encounter a problem with Localization features in ASP.NET 2.0.
| > | >>>>> Is seems that the framework is not able to manage neutral
cultures
| > such as 'fr', or
| > | >>>>> 'de'. Those are the culture sent by default from a french or
| > German
| > Internet
| > | >>>>> Explorer in France or Germany.
| > | >>>>>
| > | >>>>> There is a runtime error "System.NotSupportedException: Culture
| > "fr" is a neutral
| > | >>>>> culture. It can not be used in formatting and parsing and
| > therefore
| > cannot be set as
| > | >>>>> the thread's current culture."
| > | >>>>>
| > | >>>>> However, this happens only the first time a page in the site is
| > accessed. Other hits
| > | >>>>> are processed correctly...
| > | >>>>>
| > | >>>>> TIA.
| > | >>>>
| > | >>>>
| > | >>>
| > | >>>
| > | >>
| > | >>
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top