protected void Page_Load(object sender, EventArgs e)
{
if (Session["Lang"] == null) {
Session["Lang"] = Request.UserLanguages[0];
}
if (!IsPostBack)
{
LoadString();
}
}
protected void ddLang_SelectedIndexChanged(object sender, EventArgs e)
{
Session["Lang"] = ddLang.SelectedValue;
LoadString();
}
private void LoadString(){
Thread.CurrentThread.CurrentCulture = new CultureInfo(Session["Lang"].ToString());
rm = new ResourceManager("ASPMultilingual.App_GlobalResources.Lang", Assembly.GetExecutingAssembly());
ci = Thread.CurrentThread.CurrentCulture;
btnLogIn.Text = rm.GetString("Login", ci);
}
Here is my code and the resource file I store at App_GlocalResources as Lang.ch-CH.resx, Lang.en.EN.resx and Lang.de.DE.resx
.
After I compile, it throws an error and points to btnLogIn.Text = rm.GetString("Login", ci);
.
Inside my resource has the name of Login.