use header value instead if present to set culture on request (#15168)

This commit is contained in:
Bjarke Berg
2023-11-13 13:33:02 +01:00
committed by GitHub
parent 261586f14f
commit 16a27a4c52
2 changed files with 4 additions and 1 deletions

View File

@@ -104,7 +104,7 @@ public class UmbracoRequestMiddleware : IMiddleware
// Also MiniProfiler.Current becomes null if it is handled by the event aggregator due to async/await
_profiler?.UmbracoApplicationBeginRequest(context, _runtimeState.Level);
_variationContextAccessor.VariationContext ??= new VariationContext(_defaultCultureAccessor.DefaultCulture);
_variationContextAccessor.VariationContext ??= new VariationContext(context.Request.ClientCulture() ?? _defaultCultureAccessor.DefaultCulture, context.Request.ClientSegment());
UmbracoContextReference umbracoContextReference = _umbracoContextFactory.EnsureUmbracoContext();
Uri? currentApplicationUrl = GetApplicationUrlFromCurrentRequest(context.Request);