4

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?

0

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.