Hi,
I am trying to make 2 buttons on my aspx page to change the language. One for english and other for dutch.
this is an example of how i tried to solve it but didn't work. When i press the english flag it will goto following code
protected void btnEnFlag_Click(object sender, ImageClickEventArgs e)
{
Session["i18n"] = "en-GB";
InitializeCulture();
// This will only work if i reload the page and that's what i don't want to do
Response.Redirect("PAGE.aspx");
}
protected override void InitializeCulture()
{
String selectedLanguage;
if (Session["i18n"] != null)
{
selectedLanguage = Session["i18n"].ToString();
}
else //standard is english
{
selectedLanguage = "en-GB";
}
UICulture = selectedLanguage ;
Culture = selectedLanguage ;
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture(selectedLanguage);
Thread.CurrentThread.CurrentUICulture = new
CultureInfo(selectedLanguage);
base.InitializeCulture();
}
Anyone has tips or link with tutorial on how to do it?
Thanks in advance
I am trying to make 2 buttons on my aspx page to change the language. One for english and other for dutch.
this is an example of how i tried to solve it but didn't work. When i press the english flag it will goto following code
protected void btnEnFlag_Click(object sender, ImageClickEventArgs e)
{
Session["i18n"] = "en-GB";
InitializeCulture();
// This will only work if i reload the page and that's what i don't want to do
Response.Redirect("PAGE.aspx");
}
protected override void InitializeCulture()
{
String selectedLanguage;
if (Session["i18n"] != null)
{
selectedLanguage = Session["i18n"].ToString();
}
else //standard is english
{
selectedLanguage = "en-GB";
}
UICulture = selectedLanguage ;
Culture = selectedLanguage ;
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture(selectedLanguage);
Thread.CurrentThread.CurrentUICulture = new
CultureInfo(selectedLanguage);
base.InitializeCulture();
}
Anyone has tips or link with tutorial on how to do it?
Thanks in advance