0
votes

In my asp.net app I want to let user to change his profile language and then load respective resx file.

I have two global .resx files:

LocalizedText.resx

LocalizedText.pl.resx

protected void Page_Load(object sender, EventArgs e)
{  
      ...
      if (!IsPostBack)
      {
           setUserSettings(...)
      }                       
}

and

private void setUserSettings(...)
{
    ...
    Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("pl");
}

setUserSettings(...) is used also when user changes his profile settings.

The problem is that it is always fallbacking to LocalizedText.resx file instead of loading LocalizedText.pl.resx

I debbuged it and CurrentUICulture is always "en_US" at the beginning of Page_Load.

I tried to set also UICulture and Culture properties but it didn't work.

When I use Page.Culture="auto" it loads .pl.resx file when I set my browser language to "pl" but it is not what I want.

Any Ideas? Thanks

1

1 Answers

2
votes

I think you should override the Page InitializeCulture method and set CurrentUiCulture there. For more info see: http://msdn.microsoft.com/en-us/library/system.web.ui.page.initializeculture.aspx