Skip to content

Commit

Permalink
Setup the localization for partial MVC view requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dimarobert committed Feb 4, 2022
1 parent 088f63d commit edf4783
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions DNN Platform/DotNetNuke.Web.Mvc/DnnMvcHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ namespace DotNetNuke.Web.Mvc
using System.Web.SessionState;

using DotNetNuke.ComponentModel;
using DotNetNuke.Entities.Portals;
using DotNetNuke.HttpModules.Membership;
using DotNetNuke.Services.Localization;
using DotNetNuke.UI.Modules;
using DotNetNuke.Web.Mvc.Common;
using DotNetNuke.Web.Mvc.Framework.Modules;
Expand Down Expand Up @@ -66,6 +68,7 @@ protected virtual bool IsReusable

void IHttpHandler.ProcessRequest(HttpContext httpContext)
{
this.SetThreadCulture();
MembershipModule.AuthenticateRequest(this.RequestContext.HttpContext, allowUnknownExtensions: true);
this.ProcessRequest(httpContext);
}
Expand Down Expand Up @@ -93,6 +96,23 @@ protected virtual void ProcessRequest(HttpContext httpContext)
this.ProcessRequest(httpContextBase);
}

private void SetThreadCulture()
{
var portalSettings = PortalController.Instance.GetCurrentSettings();
if (portalSettings is null)
{
return;
}

var pageLocale = Localization.GetPageLocale(portalSettings);
if (pageLocale is null)
{
return;
}

Localization.SetThreadCultures(pageLocale, portalSettings);
}

private IModuleExecutionEngine GetModuleExecutionEngine()
{
var moduleExecutionEngine = ComponentFactory.GetComponent<IModuleExecutionEngine>();
Expand Down

0 comments on commit edf4783

Please # to comment.