diff --git a/src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/AutoroutePartHandler.cs b/src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/AutoroutePartHandler.cs index 54f95794738..309bbab1a8f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/AutoroutePartHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/AutoroutePartHandler.cs @@ -11,11 +11,13 @@ using OrchardCore.Autoroute.Drivers; using OrchardCore.Autoroute.Models; using OrchardCore.Autoroute.ViewModels; +using OrchardCore.ContentLocalization; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Handlers; using OrchardCore.ContentManagement.Metadata; using OrchardCore.ContentManagement.Records; using OrchardCore.ContentManagement.Routing; +using OrchardCore.DisplayManagement.Liquid; using OrchardCore.Environment.Cache; using OrchardCore.Liquid; using OrchardCore.Settings; @@ -388,6 +390,10 @@ private async Task GenerateContainerPathFromPattern(AutoroutePart part) ContentItem = part.ContentItem }; + _contentManager ??= _serviceProvider.GetRequiredService(); + var cultureAspect = await _contentManager.PopulateAspectAsync(part.ContentItem, new CultureAspect()); + LiquidViewTemplate.Context.CultureInfo = cultureAspect.Culture; + part.Path = await _liquidTemplateManager.RenderAsync(pattern, NullEncoder.Default, model, scope => scope.SetValue("ContentItem", model.ContentItem)); diff --git a/src/OrchardCore.Modules/OrchardCore.Autoroute/OrchardCore.Autoroute.csproj b/src/OrchardCore.Modules/OrchardCore.Autoroute/OrchardCore.Autoroute.csproj index 8df58b9469c..78a801d245b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Autoroute/OrchardCore.Autoroute.csproj +++ b/src/OrchardCore.Modules/OrchardCore.Autoroute/OrchardCore.Autoroute.csproj @@ -11,13 +11,15 @@ + - + +