locked
Globalisation resource problem RRS feed

  • Question

  • User-1690009347 posted
    I have a problem with accessing .resx language files. I get this error: "Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure "IndexServer.Res.Strings.resources" was correctly embedded or linked into assembly "IndexServer". baseName: IndexServer.Res.Strings locationInfo: <null> resource file name: IndexServer.Res.Strings.resources assembly: IndexServer, Version=1.0.3.5328, Culture=neutral, PublicKeyToken=null " The strange thing is that I have a test application with exactly the same code and with the resource files in exactly the same structure which works fine! I have been looking around the net for hours and all the answers point to me using an incorrect path to the resx files. I have used ildasm to check which path I should use and this is exactly what I am using. I am totally baffled!!! The c# code I am using is as follows (it fails on the GetString() call): (IndexApp is the namespace, Res is the folder containing the resx files and Strings is the prefix of the resx files eg Strings.en-GB.resx) CultureInfo ci=new CultureInfo("en-GB"); Thread.CurrentThread.CurrentCulture=ci; ResourceManager rm=new ResourceManager("IndexApp.Res.Strings",Assembly.GetExecutingAssembly(),null); string strTrans=rm.GetString(strOriginal,ci); Can anyone offer any help as to what may be going wrong?
    Wednesday, November 30, 2005 7:05 AM

All replies

  • User1183903743 posted
    Try:

    ResourceManager rm=new ResourceManager( "Res.Strings", Assembly.GetExecutingAssembly(),null);


    in v2.0 it would have to be inside App_GlobalResources, the regular folder doesn't matter:

    string strTrans=HttpContext.GetGlobalResourceObject("Strings", "strOriginal");

    strongly typed:

    string
    strTrans=Resources.Strings.strOriginal;


    HTH!

    Wednesday, November 30, 2005 7:56 AM
  • User-1690009347 posted
    Just using "Res.Strings" does not work either. And I forgot to say that I am using asp.net 1.1
    Wednesday, November 30, 2005 8:17 AM
  • User1183903743 posted
    It's been a long time since I messed with the ResourceManager in v1.1 and I hated every minute of it.

    Thanks to this little gem I didn't have to:

    http://www.winformreports.co.uk/features_loc.htm

    You might want to give it a spin

    HTH!
    Thursday, December 1, 2005 4:02 PM