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: 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?
Member
419 Points
498 Posts
Globalisation resource problem
Nov 30, 2005 07:05 AM|coolblue|LINK
Member
22 Points
700 Posts
Re: Globalisation resource problem
Nov 30, 2005 07:56 AM|rmprimo|LINK
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!
Rob
Member
419 Points
498 Posts
Re: Globalisation resource problem
Nov 30, 2005 08:17 AM|coolblue|LINK
Member
22 Points
700 Posts
Re: Globalisation resource problem
Dec 01, 2005 04:02 PM|rmprimo|LINK
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!
Rob