This commit is contained in:
2021-08-12 18:58:03 +01:00
parent 5e5ef7190b
commit 6a682ff9ea
51 changed files with 657 additions and 192 deletions
@@ -23,6 +23,7 @@ using Saxonite.Net.Standard.Base.Mgr;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
@@ -70,7 +71,23 @@ namespace Saxonite.Net.Core.Web.Base.Controllers
/// <para>Some actions such as scoring a password's complexity don't need to.</para>
/// </summary>
public virtual bool StoreSessionData { get; protected set; } = true;
//-------------------------------------------------------------------
// Culture.
private CultureInfo sessionCulture;
private CultureInfo RequestCulture { get { return Request.HttpContext.Features.Get<IRequestCultureFeature>().RequestCulture.Culture ?? CultureInfo.InvariantCulture; } }
public CultureInfo SessionCulture
{
get
{
if (sessionCulture == null)
{
sessionCulture = RequestCulture;
// ToDo Adjust culture if needed.
}
return sessionCulture;
}
}
private string LanguageIso2
{
get
@@ -79,6 +96,8 @@ namespace Saxonite.Net.Core.Web.Base.Controllers
return feature.RequestCulture.UICulture.TwoLetterISOLanguageName.ToLower();
}
}
//-------------------------------------------------------------------
// Business components.
public SaxInternals Internals { get { if (internals == null) internals = new SaxInternals(SessionContext); return internals; } }
// Consoles.
@@ -191,6 +210,7 @@ namespace Saxonite.Net.Core.Web.Base.Controllers
if (model == null) return;
// Session data.
model.Controller = this;
model.SessionData = SessionData;
// Redirect locations.