.Net 2.0 has a nice system for globalization using resource files. For some reason I had never actually used resource files in a class library and as it turned out, it wasn't that easy to find info about this on the web (which surprised me).
In a webapplication project, you can just do something like
Resources.MyApp.Helloworld
To access the resource string Helloworld in the MyApp.resx file. This however, doesn't work in a class library, so I implemented globalization in my webcontrol using the following code:
System.Resources.ResourceManager man = new System.Resources.ResourceManager("MyNameSpace.App", Assembly.GetExecutingAssembly());
string helloworld = string.Empty;
if (man != null)
{
helloworld = man.GetString("Helloworld", Thread.CurrentThread.CurrentUICulture);
}
As it turns out, there is a much simpler way to do it, which is described in the blogpost: Localizing Web Parts, Custom Controls, and Class Libraries.
You can just do: myapp.Helloworld. That's it. You do have to make sure your class and the resx file are in the same namespace (or reference is by namespace of course). "MyApp" in this case is the class name of the resource file (you can look it up in the designer.cs created along with the .resx).
Cheers,
Rinze