Tech Off Post

Single Post Permalink

View Thread: How can I add new resources to an Application ?
  • User profile image

    Basically I add a new resource file to my project, then rename the file with the appropriate culture code.  I then copy the data keys from the default resource file into the new culture resource file and change as appropriate.

    So if I had an ASP.NET project with the file test.aspx.resx as my default resource file, I would add a new resource file for English with the name test.aspx.en.resx and add another resource file for Spanish with the name  Now copy the <data> elements from test.aspx.resx and place them in test.aspx.en.resx and  Then edit the <value> element contents as appropriate for the culture.

    Once I rebuild my project, VS.NET will create the appropriate structure under the bin directory.

    If you want to define a more specifc culture resource files, you can just use that culture identifier code.  So in your example, you use en-US and es-ES.  This would translate in my example to be the files: test.aspx.en-us.resx and  Along with these files you could still have the other files: test.aspx.en.resx and

    When your user is associated with the culture identifier en-UK, the .NET framework will see only the resource files for en and en-US.  It doesn't find en-UK so it strips the the -UK and will find the en resource file and use it.  If you didn't have the en resource file, the .NET framework will use the default resoruce file as a last resort.

    Hope that helps, Grumpy.