views:

321

answers:

2

I have a Strings.resx and a Strings.nl.resx file. The first contains a English string, the other a Dutch string. They are part of a C# Class Library project: Module.

 public static string testString()
 {          
      //I Force the culture to always be english
       Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-US");
       Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US");
       return Strings.Hello;
 }

When I call them from a simple Console Application, it works:

  Console.WriteLine(Module.testString()); //English string gets returned

When I do the same from my ASP.NET MVC application, I get the Dutch version...

    public ActionResult testCulture()
    {
        return Content(Module.testString()); //Dutch string gets returned..?!
    }

I am using a Dutch Windows, so any auto-setting will be Dutch.But how can I get a different string when the culture is hardcoded to en-us in the class library??

What am i missing here?

+1  A: 

Do you have a Neutral Resources Language specified anywhere? If it is set to "nl" or "nl-NL", any request for a resource that is not found will eventually end up fetching the "nl" resource. Since you do not have a Strings.en-US.resx or Strings.en.resx, setting CurrentUICulture to "en-US" would make the system use the neutral resources language.

Fredrik Mörk
A: 

check if your web.config is not having a globalization tag having a language set to dutch

or

if you are using internet explorer, go to tools > internet options and click on language button, if it's showing dutch language before the english one, change it

lakhlaniprashant.blogspot.com