locked
How to Localize ASP.NET 2.0 Web Apps with Resources and Satellite Assemblies RRS feed

  • Question

  • User-439948308 posted
    I spent a great deal of time learning about satellite assemblies the past few days. While I found this forum very helpful, I still couldn't find what I was looking for. I had a lot of problems figuring out how to reference Resources from satellite assemblies from an ASP.NET 2.0 application.

    So after I figured it out, I wrote up a quick HOW-TO on what I think is the good way to overcome several of the problems I came across, such as what Assembly to pass to the ResourceManger, falling back to the the main assembly for neutral values, and Strongly-Typed resources.

    I welcome any feedback or improvements.

    Localizing ASP.NET 2.0 Web Apps with Resources and Satellite Assemblies



    Thursday, January 26, 2006 9:32 PM

All replies

  • User-977778068 posted

    hi,

    I am not able to get the specific language of my choice displayed, it'd always go to the default strings.resx file.  I have the German .resx file, and a couple of other custom languages added to the sample Solutions. 

    In global.asax, I had specified

    CreateSpecificCulture("de-DE"); as per your article but I am only getting the English rendered each time!!

    I am not sure what I did wrong, please help!

    Le Rien

    Monday, January 30, 2006 10:52 AM
  • User-439948308 posted
    The problem lies with the application not finding a resource file for your language, and it's reverting to English.

    First, did you build the project yourself or did you start with my sample project? If you did it yourself, you might start with the sample to eliminate any configuration issues. Then once you get it working and understand, then build it from scratch

    Second, in step 16, does your project structure look like the one in the screenshot? The directory structure has to look exactly like the one in the screenshot with:

    \Bin
        MyWebApp.dll <-Must be equal to each other
         \de-DE
                 MyWebApp.resources.dll <-Must be equal to each other

    Also, double check that Default.aspx (or whatever you web page is) doesn't have either
    • Culture="Auto"
    • UICulture="Auto"
     attributes in <%@ Page%> . If these are present, they will override the Culture defined in the Global.asax for that page only.

    Also check in the debugger what the culture is defined as in the code behind for your test page.
    Monday, January 30, 2006 3:32 PM
  • User-977778068 posted

    I started with your sample project.  And I don't have any Culture or UICulture settings on my Default.aspx page.

    I have the same exact structure as the one you have on step 16.

    In addition to the \de-DE folder, I have added a \fr-FR folder, but when building the solution, only the \de-DE\MyWebApp.resources.dll is created under the \bin folder, along with the \Bin\MyWebApp.dll, why isn't the \fr-FR created along with the rest?    I have made sure I follow every step. 

     

     

    Tuesday, January 31, 2006 9:47 AM
  • User-439948308 posted
    LoisLee,

    After I reviewed your solution that you sent me, you missed step 7, which is to add a reference to the Satellite Assembly in your Web App. After I did that, the Bin directory was correct with the fr-FR directory and resource files, and after I updated the Global.asax to use fr-FR, the page came up with your French values.


    Tuesday, January 31, 2006 1:54 PM