diff --git a/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Values/CultureValue.cs b/src/OrchardCore.Modules/OrchardCore.Localization/Liquid/CultureValue.cs similarity index 97% rename from src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Values/CultureValue.cs rename to src/OrchardCore.Modules/OrchardCore.Localization/Liquid/CultureValue.cs index d92c20feb05..93b912de565 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Values/CultureValue.cs +++ b/src/OrchardCore.Modules/OrchardCore.Localization/Liquid/CultureValue.cs @@ -4,9 +4,8 @@ using Fluid.Values; using Microsoft.Extensions.DependencyInjection; using OrchardCore.Liquid; -using OrchardCore.Localization; -namespace OrchardCore.DisplayManagement.Liquid.Values; +namespace OrchardCore.Localization.Liquid; internal sealed class CultureValue : FluidValue { diff --git a/src/OrchardCore.Modules/OrchardCore.Localization/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Localization/Startup.cs index c035f05d418..89491be6a13 100644 --- a/src/OrchardCore.Modules/OrchardCore.Localization/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Localization/Startup.cs @@ -1,3 +1,4 @@ +using Fluid; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; @@ -8,6 +9,7 @@ using OrchardCore.DisplayManagement.Handlers; using OrchardCore.Environment.Shell; using OrchardCore.Localization.Drivers; +using OrchardCore.Localization.Liquid; using OrchardCore.Localization.Models; using OrchardCore.Localization.Services; using OrchardCore.Modules; @@ -97,3 +99,13 @@ public override void ConfigureServices(IServiceCollection services) options.AddInitialRequestCultureProvider(new AdminCookieCultureProvider(_shellSettings, _adminOptions))); } } + +[RequireFeatures("OrchardCore.Liquid")] +public sealed class LocalizationLiquidStartup : StartupBase +{ + public override void ConfigureServices(IServiceCollection services) + { + services.Configure(options + => options.Scope.SetValue("Culture", new CultureValue())); + } +} diff --git a/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/OrchardCoreBuilderExtensions.cs b/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/OrchardCoreBuilderExtensions.cs index ce638e81bde..e4ab4a198d8 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/OrchardCoreBuilderExtensions.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/OrchardCoreBuilderExtensions.cs @@ -1,4 +1,3 @@ -using System.Globalization; using Fluid; using Fluid.Values; using Microsoft.AspNetCore.Html; @@ -13,12 +12,10 @@ using OrchardCore.DisplayManagement.Liquid.Filters; using OrchardCore.DisplayManagement.Liquid.TagHelpers; using OrchardCore.DisplayManagement.Liquid.Tags; -using OrchardCore.DisplayManagement.Liquid.Values; using OrchardCore.DisplayManagement.Razor; using OrchardCore.DisplayManagement.Shapes; using OrchardCore.DisplayManagement.Zones; using OrchardCore.Liquid; -using OrchardCore.Localization; namespace Microsoft.Extensions.DependencyInjection; @@ -69,8 +66,6 @@ public static OrchardCoreBuilder AddLiquidViews(this OrchardCoreBuilder builder) o.MemberAccessStrategy.Register("*", new ShapeAccessor()); o.MemberAccessStrategy.Register(); - o.Scope.SetValue("Culture", new CultureValue()); - o.Scope.SetValue("Environment", new ObjectValue(new LiquidEnvironmentAccessor())); o.MemberAccessStrategy.Register((obj, name, ctx) => {