System.Web.Mvc.LocalizedViewEngine.FindView C# (CSharp) Method

FindView() public method

Finds the localized view
public FindView ( System.Web.Mvc.ControllerContext controllerContext, string viewName, string masterName, bool useCache ) : System.Web.Mvc.ViewEngineResult
controllerContext System.Web.Mvc.ControllerContext
viewName string
masterName string
useCache bool
return System.Web.Mvc.ViewEngineResult
        public override ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache)
        {
            List<string> searched = new List<string>();

            if (!string.IsNullOrEmpty(viewName))
            {
                ViewEngineResult result;

                result = base.FindView(controllerContext, string.Format("{0}.{1}", viewName, CultureInfo.CurrentUICulture.Name), masterName, useCache);

                if (result.View != null)
                {
                    return result;
                }

                searched.AddRange(result.SearchedLocations);

                result = base.FindView(controllerContext, string.Format("{0}.{1}", viewName, CultureInfo.CurrentUICulture.TwoLetterISOLanguageName), masterName, useCache);

                if (result.View != null)
                {
                    return result;
                }

                searched.AddRange(result.SearchedLocations);
            }

            return new ViewEngineResult(searched.Distinct().ToList());
        }
LocalizedViewEngine