I am using resource files to switch languages in my web application which is build in mvc5
In index files its reading the culture value which i set.
I am calling the set culture method from layout.cshtml and calling its value with the following code.
@{
Layout = "~/Views/Shared/_Layout.cshtml";
if (!Request["dropdown"].IsEmpty())
{
Culture = UICulture = Request["dropdown"];
}
}
in index page the language is loading correctly but when from there when i go to the next page its loading the default language German but the resources reading from English resource file only.
Please help me on this..anybody
In
web.config
I commented the following line inside and it worked fine for me.You have to persist the information about current culture somewhere (I recommend cookie) and set thread culture to this cookie value (if present) - preferably in
Application_BeginRequest
of yourGlobal.asax
.for globally setting I suggest you to add the following lines to the global.asax.cs file: (in this example the culture sets to Israel hebrew )