I created 3 options idioms to my WebApp. This idiom are set in Buttons in all pages. The first option idiom is set CurrentInfo.
My question is, who I can set in others pages this Idiom that user set in Homepage?
for example, to each page, in Page_Load I have this config:
Idioma.MudaCultura(CultureInfo.CurrentCulture.TwoLetterISOLanguageName.ToString());
My Button Event in Home Page. (basically this is the same for all pages)
protected void es_OnChange(object sender, EventArgs e)
{
Idioma.MudaCultura("es");
lblWelcome.Text = Idioma.RetornaMensagem("welcome");
btnRequestAccess.Text = Idioma.RetornaMensagem("btnRequestAccess");
btnTickets.Text = Idioma.RetornaMensagem("btnTickets");
btnManager.Text = Idioma.RetornaMensagem("btnManager");
btnManageFolders.Text = Idioma.RetornaMensagem("btnManageFolders");
}
My class Idiom
public class Idioma
{
private string chaveRM = "";
public string ChaveRM
{
get { return chaveRM; }
set { chaveRM = value; }
}
public static string RetornaMensagem(string NomeMensagem)
{
ResourceManager resx = new ResourceManager(typeof(RM));
return resx.GetString(NomeMensagem, System.Threading.Thread.CurrentThread.CurrentCulture);
}
public static void MudaCultura(string cultura)
{
if (cultura=="pt")
{
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("pt", true);
}
else if(cultura=="en")
{
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en", true);
}
else if (cultura == "es")
{
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("es", true);
}
}
}
What I need is setting CurrentInfo
with option that User was set in HomePage and if is different of this CurrentInfo.
Example:
Home: My CurrentInfo is "en-US". Home: I change my Idiom to "es-ES". Other page: I need get this new CurrentInfo("es-ES").
Am I clear?