Skip to content

Commit

Permalink
Added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
donker committed Oct 31, 2020
2 parents 868cb58 + c2cb40c commit da5d855
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions DNN Platform/HttpModules/Localization/LocalizationModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@ public void Dispose()
// intentionally left empty
}

/// <summary>
/// The PreRequestHandlerExecute event happens after AuthenticateRequest. This means this code will
/// run after we know the identity of the user. This allows for the accurate retrieval of the locale
/// which depends not just on the site and page locale, but also on the user's preference.
/// </summary>
private static void Context_PreRequestHandlerExecute(object sender, EventArgs e)
{
// We need to ensure that we don't run this code when not requesting a page as otherwise we may not have
// an accurate portal identified (e.g. resources)
var isPage = HttpContext.Current.CurrentHandler is Framework.PageBase;
if (!isPage)
{
Expand All @@ -38,6 +45,8 @@ private static void Context_PreRequestHandlerExecute(object sender, EventArgs e)
return;
}

// The portalSettings should always be correct at this point, but in case we can't find a portal
// we need to insure we're not setting the thread locale.
var portalSettings = PortalController.Instance.GetCurrentSettings();
if (portalSettings != null)
{
Expand Down

0 comments on commit da5d855

Please sign in to comment.