I have a problem with the way I have set multi langugae in my MVC project. Right now I have a function which sets the selected language :
public void SetLanguage(string lang)
{
CultureInfo ci = new CultureInfo(lang);
System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
}
This is OK and sets the language but I need to do this in all the actions of my controller.
The language is obtained from the URL containing an id as parameter. This id is encrypted and contains some info among the language.
So the first time the user login in the app, the id is created and encrypted and is passed as parameter in the url.
Then the parameter is recuperated from the URL, decrypted and the language is set using the above code.
But I need to do this, set the language each time, in each action. Any idea why is this so? How and to set the language only once so that I don't need to call the SetLanguage method in each action.