470,636 Members | 1,507 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,636 developers. It's quick & easy.

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
jm*******@solaire.com
Nov 17 '05 #1
3 3464
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

<jm*******@solaire.com> wrote in message
news:Or**************@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
jm*******@solaire.com

Nov 17 '05 #2
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? http://www.gotdotnet.com
--------------------
!From: "Michael Jones" <no****@bogus.foo>
!References: <Or**************@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: <em**************@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
!
!<jm*******@solaire.com> wrote in message
!news:Or**************@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
!> jm*******@solaire.com
!
!
!

Nov 17 '05 #3
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
jm*******@solaire.com
Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Jamie Fraser | last post: by
6 posts views Thread by Rental | last post: by
2 posts views Thread by Alex Maghen | last post: by
5 posts views Thread by archana | last post: by
2 posts views Thread by shapper | last post: by
3 posts views Thread by Computer Guru | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.