I’m working on a quite simple Webpage (MVC2), using localisation based on Resource Files.
I have the MVC2 Project and the Resources in a seperate Assembly.
The Resources contains 3 languages (Resource.resx, Resource.de.resx, Resource.en.resx, Resource.ja.resx) and I’m querying them via the ResourceManager.
Call from the .aspx page:
<% Resources.Res resman = new Resources.Res(); %>
<%=resman.GetString("String1", new System.Globalization.CultureInfo("en")) %><br />
<%=resman.GetString("String1", new System.Globalization.CultureInfo("ja")) %><br />
<%=resman.GetString("String1", new System.Globalization.CultureInfo("de")) %><br />
The ResourceManager:
public class Res
{
private readonly ResourceManager Manager = Resources.Resource1.ResourceManager;
public string GetString(string id, CultureInfo info)
{
return Manager.GetString(id, info);
}
}
Gor the compiled version in VS2008 I get something like this:
String1EN
String1JA
String1DE
Compiled in Visual Studio 2008, this works fine, but I’m having trouble if I compile the solution in Visual Studio 2010 (also 3.5 as TargetFramework).
There the result shows something like:
String1DEFAULT
String1JA
String1DEFAULT
I don’t know what it can be: is this still a bug from the VS2010 RC or am I doing something wrong here?
UPDATE:
I found out that it works on IIS 7.5, but not on IIS 7.0. Unfortunately its not a solution for me.
I didn’t figure out what was going wrong. But since VS2010 and .NET 4.0 was released yesterday, I got the chance to try it out with the released version and it worked fine.
So I guess it was just a bug in the RC which was fixed now.