Ask a Question related to ASP.NET General, Design and Development.
-
jmjacquel@solaire.com #1
ASP.NET page localization problems
Hi all,
I have a localization problem in ASP.NET (ASPX) pages using VS.NET 2003.
I have a project called AGCENTRAL, which is part of a solution. The project
simply contains pages, a MyResources.resx file and a MyResources.frr.resx
file. In these two files, I have a simple string named mystr with "Hello
user" in the MyResources.resx file and mystr with "Bonjour Utilisateur" in
the MyResources.fr.resx file.
I try to access these resources using the following code :
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture("fr");
Thread.CurrentThread.CurrentUICulture =
CultureInfo.CreateSpecificCulture("fr");
ResourceManager rm = new ResourceManager("AGCENTRAL.MyResources",
Assembly.GetExecutingAssembly());
thestr=rm.GetString(resid);
When I compile the project, I correctly get the following assemblies :
bin/AGCENTRAL.DLL
bin/fr/AGCENTRAL.resoources.dll
But when the code is running, I always get the default resource value "Hello
user" instead of the correct culture resource value "Bonjour Utilisateur".
I tried to compile the resources files manually using resgen and creating
the satellite assemblies manually too using AL with the same result. I read
many samples or technical notes, doing exactly what was written with always
the same result. I am surely missing something ?!
Any help would be very appreciated !
Best regards,
Jean-Michel JACQUEL
[email]jmjacquel@solaire.com[/email]
jmjacquel@solaire.com Guest
-
Localization
Hi I would like to make some of my director projects available in a number of languages, including Lithuanian which I believe uses unicode text.... -
Haveing Page Formatting problems with Crystal Report in my asp.net page..
Hi Every one, I am using Crystal reports(vers 9.2.3) for a report we need. Now i am using my desktop for development and the report looks nice and... -
Problems with localization
Hi everybody. It's my first message, I hope I'm in the right ml. I'm using postgresql 7.4.6 on gentoo 2004.2. I've set nls use flag in... -
Problems with Enterprise Localization Framework and .NET FW 1.1
We had downloaded the Enterprise Localization Framework a few months ago for evaluation and were using it under .NET Framework 1.0. We've just... -
help with localization
Hi Paul I'm afraid that setting the page Culture and uiCulture properties only serve to set the executing threads CurrentCulture and... -
Michael Jones #2
Re: ASP.NET page localization problems
Since you are calling CreateSpecificCulture with the neutral culture of "fr"
it is defaulting to a specific culture of fr-FR (French language in the
country of France). So you can either create a new resource file named
MyResources.fr-FR.resx or if you prefer to stick to the neutral french you
could change your code to:
Thread.CurrentThread.CurrentUICulture=new CultureInfo("fr");
HTH,
Michael Jones
<jmjacquel@solaire.com> wrote in message
news:Orc8fYiRDHA.2676@TK2MSFTNGP10.phx.gbl...project> Hi all,
>
> I have a localization problem in ASP.NET (ASPX) pages using VS.NET 2003.
>
> I have a project called AGCENTRAL, which is part of a solution. The"Hello> simply contains pages, a MyResources.resx file and a MyResources.frr.resx
> file. In these two files, I have a simple string named mystr with "Hello
> user" in the MyResources.resx file and mystr with "Bonjour Utilisateur" in
> the MyResources.fr.resx file.
>
> I try to access these resources using the following code :
>
> Thread.CurrentThread.CurrentCulture =
> CultureInfo.CreateSpecificCulture("fr");
> Thread.CurrentThread.CurrentUICulture =
> CultureInfo.CreateSpecificCulture("fr");
> ResourceManager rm = new ResourceManager("AGCENTRAL.MyResources",
> Assembly.GetExecutingAssembly());
> thestr=rm.GetString(resid);
>
> When I compile the project, I correctly get the following assemblies :
>
> bin/AGCENTRAL.DLL
> bin/fr/AGCENTRAL.resoources.dll
>
> But when the code is running, I always get the default resource valueread> user" instead of the correct culture resource value "Bonjour Utilisateur".
>
> I tried to compile the resources files manually using resgen and creating
> the satellite assemblies manually too using AL with the same result. Ialways> many samples or technical notes, doing exactly what was written with> the same result. I am surely missing something ?!
>
> Any help would be very appreciated !
>
> Best regards,
>
> Jean-Michel JACQUEL
> [email]jmjacquel@solaire.com[/email]
Michael Jones Guest
-
Yan-Hong Huang[MSFT] #3
Re: ASP.NET page localization problems
Hello Jean,
Is the problem resolved now? If there are follow up questions, please post
here. Thanks.
Best regards,
yhhuang
VS.NET, Visual C++
Microsoft
This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net? [url]http://www.gotdotnet.com[/url]
--------------------
!From: "Michael Jones" <nospam@bogus.foo>
!References: <Orc8fYiRDHA.2676@TK2MSFTNGP10.phx.gbl>
!Subject: Re: ASP.NET page localization problems
!Date: Wed, 9 Jul 2003 15:24:22 -0400
!Lines: 59
!X-Priority: 3
!X-MSMail-Priority: Normal
!X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
!X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
!Message-ID: <empD9#kRDHA.2432@TK2MSFTNGP10.phx.gbl>
!Newsgroups: microsoft.public.dotnet.framework.aspnet
!NNTP-Posting-Host: 174-33.no1.howardweil.com 216.116.174.33
!Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:158093
!X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
!
!Since you are calling CreateSpecificCulture with the neutral culture of
"fr"
!it is defaulting to a specific culture of fr-FR (French language in the
!country of France). So you can either create a new resource file named
!MyResources.fr-FR.resx or if you prefer to stick to the neutral french you
!could change your code to:
!
!Thread.CurrentThread.CurrentUICulture=new CultureInfo("fr");
!
!HTH,
!
!Michael Jones
!
!<jmjacquel@solaire.com> wrote in message
!news:Orc8fYiRDHA.2676@TK2MSFTNGP10.phx.gbl...
!> Hi all,
!>
!> I have a localization problem in ASP.NET (ASPX) pages using VS.NET 2003.
!>
!> I have a project called AGCENTRAL, which is part of a solution. The
!project
!> simply contains pages, a MyResources.resx file and a MyResources.frr.resx
!> file. In these two files, I have a simple string named mystr with "Hello
!> user" in the MyResources.resx file and mystr with "Bonjour Utilisateur"
in
!> the MyResources.fr.resx file.
!>
!> I try to access these resources using the following code :
!>
!> Thread.CurrentThread.CurrentCulture =
!> CultureInfo.CreateSpecificCulture("fr");
!> Thread.CurrentThread.CurrentUICulture =
!> CultureInfo.CreateSpecificCulture("fr");
!> ResourceManager rm = new ResourceManager("AGCENTRAL.MyResources",
!> Assembly.GetExecutingAssembly());
!> thestr=rm.GetString(resid);
!>
!> When I compile the project, I correctly get the following assemblies :
!>
!> bin/AGCENTRAL.DLL
!> bin/fr/AGCENTRAL.resoources.dll
!>
!> But when the code is running, I always get the default resource value
!"Hello
!> user" instead of the correct culture resource value "Bonjour
Utilisateur".
!>
!> I tried to compile the resources files manually using resgen and creating
!> the satellite assemblies manually too using AL with the same result. I
!read
!> many samples or technical notes, doing exactly what was written with
!always
!> the same result. I am surely missing something ?!
!>
!> Any help would be very appreciated !
!>
!> Best regards,
!>
!> Jean-Michel JACQUEL
!> [email]jmjacquel@solaire.com[/email]
!
!
!
Yan-Hong Huang[MSFT] Guest
-
jmjacquel@solaire.com #4
Re: ASP.NET page localization problems
Thank you Michael and Yhhuang for your answers.
Michael, I've already done that without success. I've found the solution by
myself and will explain here what was wrong. In fact, every code I wrote to
solve this problem was correct as I kept each one beside and tried them
again later. As I set impersonation to true, I simply had to set correct
authorizations to the temporary ASP.NET files in the .NET folder. This way,
all my tests are now working correctly.
So, I suppose this thread will help people who are developing multi-lingual
ASP.NET application and using impersonation !
Many thanks again,
Best regards,
Jean-Michel JACQUEL
[email]jmjacquel@solaire.com[/email]
jmjacquel@solaire.com Guest



Reply With Quote

