asp.net - ModelState ErrorMessage Culture Localization -


I have read these questions and they did not solve the problem .

My problem: Model verification validation error message is always in English I. Localization does not work.

Localization at.T. Public class Localization Rights: ActionActivities {Public Override Zero Onset Exposing (ActionexPoint Contact Filter Contrax) {if (FilterContext.RouteData.Values ​​["lang"]! = Faucet & amp; amp; ;; String.isnellOnWiteSite (filtercontact.routedData value ["lung"] .tostring ()) {// Set culture from root data (url) string long = filtercontext.routed data. ["Lang"] .tost Current (documented); current documentary. Current UK Agriculture = New CultureInfo (Lang); Thread.ContratTrade.CurrentCulture = New CultureInfo (Long); CultureInfo.DefaultThreadCurrentCulture = New CultureInfo (Lang); CultureInfo.DefaultThreadCurrentUICulture = New CultureInfo (Lang) ; FilterContext.HttpContext.Session.Add ("Culture", New Culture Difference (Lang))} else {// Browser Culture String Longheader = FilterContacts. HTTPPTEX Request User [0]; ThreadCentrethr Dkkurntukalcr = Kalcrinfoksent Spranifikshaiccr (Lang header); thread. Present. Culture, New Snskritiinfo (LangHeader); FilterContext.RouteData.Values ​​["lang"] = langHeader; } Base.OnActionExecuting (filterContext); }}

web.config

  & gt; Globalization Culture = "Auto" uiCulture = "auto" enableClientBasedCulture = "wrong" / & gt;  ; RouteConfig.RegisterRoutes (RouteTable.Routes); AutoMapperConfiguration.Configure (); FilterConfig.RegisterGlobalFilters (GlobalFilters.Filters); BundleConfig.RegisterBundles (BundleTable.Bundles); // View Engine SetView Engine. Engine. Clear (); ViewEngines.Engines.Add (New MyCustomViewEngine (SiteSettings.Theme)); Public} Filter Filter {Global Static Zero Register Global Filter} {} Filters.Add (new handlereal attribute ()); Filter. Add (new localization ()); I do not know how to do this  = "post -text" itemsprop = "text"> 

By localization you will not receive what you want. Because, when you set both threads, it's too late. Current Thread Current ukucar or thread Current and field. In Onion Excipitioning (Action Accepting Contact Filter Context) method. When OnActionExecuting is removed ModelState errors are already determined by assembly culture The first solution is to override the base controller (System.Web.Routing.RequestContext requestContext) method in the base controller and set the required culture in the thread. The second solution is Application_BeginRequest (Object Sender, Eventarges e) overriding in Global.ass

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -