static void

Globalization

Setting the culture

On all string/number/date operations use the optional formatting argument (FXCop will complain if you don't). Either System.Globalization.CultureInfo.CurrentCulture or .InvariantCulture (if applicable).

See Intro (Rick Strahl); see also serverside.net and ondotnet.com

For the web, the HTTP header contains user languages (set within IE-Tools-Internet Options-Languages) which you can read in Request.UserLanguages[0] (for the first one). ASP 1: Read it (or a cookie from a user form) in Global.asax Session_Start. In ASP 2 it's automatic.

Resource Files

Use assembly linker for satellite assemblies: al /t:lib /culture:en-UK /embed:strings.en-UK.resources /out:myapp.resources.dll

.Net 1

To load localised strings, the easiest way is a static/shared ResourceManager, passing the current class type:

//C#
static ResourceManager rm = new ResourceManager(typeof(ThisClass));
'VB
Shared rm As ResourceManager = New ResourceManager(GetType(ThisClass))

Or pass in the assembly - System.Reflection.Assembly.GetExecutingAssembly() - or even an external assembly

Dim a As Assembly = Assembly.Load("qq")
Dim rm As ResourceManager = New ResourceManager("qq", a)
return rm.GetString("key")

.Net 2

App_GlobalResources (Resources namespace, with intellisense) or App_LocalResources (page specific) .No more ResourceManager!