public override void OnActionExecuting(ActionExecutingContext filterContext) { if (filterContext == null) { throw new ArgumentNullException("filterContext"); } var ctx = filterContext.HttpContext; var locale = new RequestLocale(ctx.Request.Cookies, ctx.Response.Cookies); locale.Caching.CookieName = "_" + ParamName; if (locale.LoadFromString(ctx.Request.QueryString[ParamName])) { locale.Cache(); } else { locale.LoadFromCache(); } var loc = locale.Value ?? (Default ?? null); if (loc != null) { Thread.CurrentThread.CurrentUICulture = loc; if (!OnlyUI) { Thread.CurrentThread.CurrentCulture = loc; } } }
public override void OnActionExecuting(ActionExecutingContext filterContext) { if (filterContext == null) throw new ArgumentNullException("filterContext"); var ctx = filterContext.HttpContext; var locale = new RequestLocale(ctx.Request.Cookies, ctx.Response.Cookies); locale.Caching.CookieName = "_" + ParamName; if (locale.LoadFromString(ctx.Request.QueryString[ParamName])) { locale.Cache(); } else { locale.LoadFromCache(); } var loc = locale.Value ?? (Default ?? null); if (loc!=null) { Thread.CurrentThread.CurrentUICulture = loc; if (!OnlyUI) Thread.CurrentThread.CurrentCulture = loc; } }