hi all,
I need some help. I'm doing a dual-lingual application with resource files and I must allow the user to change the language at the click of a button.
So, I have my resource files with the strings of the various languages but i'm not able to get the browser to pick up the new locale that I specified.
Here's how I tried to do it:
// This is a function in a generic Utility.cs class
public static void setLocale(string newLocale){
try
{
System.Threading.Thread.CurrentThread.CurrentCulture =
new System.Globalization.CultureInfo(newLocale);
}
catch (Exception ex)
{
// write to log file
}
}
//the following codes is done everytime a page is loaded (postback or not).
base.InitializeCulture();
// this is the code in my button
protected void lnkLanguage_Click(object sender, EventArgs e)
{
if (lblLanguage.Text == "")
{
lblLanguage.Text = "ch";
Utility.setLocale("zh-HK");
}
else
{
lblLanguage.Text = "";
Utility.setLocale(SecuredSession.Culture);
}
}
what am I doing wrong?? or should i be doing it another way??
Thanks in advance