Asp.net Mvc 2.0 RC Setting Thread CurrentCulture/Ui
I been pulling my hair out all day.
i can't seem to set the current thread cultureui or culture to anything other than English. In the controller i have
protected override void Initialize(System.Web.Routing.RequestContext requestContext)
{
base.Initialize(requestContext);
CultureInfo cultureInfo = CultureInfo.GetCultureInfo("fr-FR");
Thread.CurrentThread.CurrentCulture = cultureInfo;
Thread.CurrentThread.CurrentUICulture = cultureInfo;
}
in my view i have
<%= Thread.CurrentThread.C开发者_运维问答urrentUICulture.EnglishName%>
the thread seems to be fine but as soon as the view renders some how its back to english!!
I know its a RC, so is it broken or am I missing something ??
cheers
Johnny
Set the language later. I use a filter that runs before the action (OnActionExecuting).
My first shot at it would be to set it in the action.
Got it working.Bizarrely i just created a new project and started again and it all works fine. All the different ways people have suggested worked in the new project. I have yet to find out what the difference is between the 2 projects.
Cheers
Johnny
精彩评论