0

I have two resources files, Emails.es.resx (es-ES) and Emails.eu.resx (eu-ES), and I have a problem to retrieve a string from eu-ES file with myLib.Emails.ResourceManager.GetString("textKey", "eu-ES");

At local this works properly but at server, is a web app + IIS, not works, always return a correct value of "textKey" but with default language es-ES.

I cleaned the solution and rebuilded all, but without results.

Does anyone knows what could happen?

2 Answers2

0

Make sure you set the correct culture. Suppose you have given option somewhere at website default page where user can choose language. On language change save the selected language in application state somewhere.. session or catch or whatever suite you. Set culture as following explained at following link:

  protected void Page_PreInit(object sender, System.EventArgs e) {

    System.Globalization.CultureInfo lang = null;
    lang = new System.Globalization.CultureInfo("zh-CN");

    System.Threading.Thread.CurrentThread.CurrentCulture = lang;
    System.Threading.Thread.CurrentThread.CurrentUICulture = lang;

}

Now retrieve your resources.. it should return correct one.

Munawar
  • 2,588
  • 2
  • 26
  • 29
  • Retrieve your selected language/culture and use instead of "zh-CN" in following line. System.Globalization.CultureInfo("zh-CN"); – Munawar Jul 26 '12 at 11:53
  • You should just pop this into the web.config file, a lot easier to change. There's a globalization tag in system.web where you can set these languages! – Steen Tøttrup Jul 26 '12 at 12:00
  • Yes, I tried change those properties but not working. Is it may have to change some options in IIS? – Daniel Valcarce Jul 26 '12 at 12:48
0

Rename your files to Emails.es-ES.resx and Emails.eu-ES.resx