Question : Resx Language Problem

Hi all,

I have my web app set up with asp text labels being fed from .resx files (multiple languages). I can go to browser settings and change language - this works fine. But I'm looking to programmatically set the language from radio buttons. I've read a lot on the subject and am aware that CurrentUICulture can be used, but apparently not for me. I've tried several variations of commands from system.threading and system.globalisation but to no avail.

I'm using VS 2010 and .NET 4.0 - I haven't tried much with the resources manager but would welcome suggestions,

any help appreciated,

Jonathan

Answer : Resx Language Problem

This should help you: Its some code that I use

[code]
protected override void InitializeCulture()
        {

        if ((string)Request.Form["__EVENTTARGET"] == "WUC_user_preferences_wuc$Button_Update_Preferences")
            {
                string selectedLanguage;
                selectedLanguage = Request.Form["WUC_user_preferences_wuc$DropDownList_User_Language"];
                UICulture = selectedLanguage;
                Culture = selectedLanguage;

                Session["User_Default_Language_Culture"] = selectedLanguage;
            }

            if (Session["User_Default_Language_Culture"] != null)
            {
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture((string)Session["User_Default_Language_Culture"]);
                Thread.CurrentThread.CurrentUICulture = new CultureInfo((string)Session["User_Default_Language_Culture"]);
            }
           
            base.InitializeCulture();
        }
[/code]

I listen out for a postback caused by button "Button_Update_Preferences" which is inside my user control "WUC_user_preferences_wuc" - hence the "WUC_user_preferences_wuc$Button_Update_Preferences"

Then I get the language selected by the user from the dropdownlist "WUC_user_preferences_wuc$DropDownList_User_Language"

The sessions are there because I store the selected language in a session for each user.

Hope this helps!!
Random Solutions  
 
programming4us programming4us