I believe that there are many ways to achieve this, but you can follow this below.
First, you can accept some kind of naming convention for views by adding a culture suffix to your names, such as ViewName_ en-US .cshtml, ViewName_ pl-PL .cshtml, etc.
If so, do not create these names in each action separately depending on the current culture. Just write the general logic that will take care of this - the base controller using the override OnActionExecuted method:
public class BaseController : Controller { protected override void OnActionExecuted(ActionExecutedContext filterContext) { base.OnActionExecuted(filterContext); var view = filterContext.Result as ViewResultBase; if(view != null) { var viewName = string.IsNullOrEmpty(view.ViewName) ? filterContext.RouteData.Values["action"].ToString() : view.ViewName;
Actions do not require localization processing right now:
public class HomeController : BaseController { public ActionResult AboutUs() {
source share