ASP.NET page localization problems

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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....
    2. 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...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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...
    > 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]

    Michael Jones Guest

  4. #3

    Default 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

  5. #4

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139