Skip to content

Commit

Permalink
Add request localization settings to the configured one (OrchardCMS#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
hishamco authored and urbanit committed Mar 18, 2024
1 parent 5d87585 commit 0fa2389
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/OrchardCore.Modules/OrchardCore.Localization/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ public override async ValueTask ConfigureAsync(IApplicationBuilder app, IEndpoin
var supportedCultures = await localizationService.GetSupportedCulturesAsync();

var cultureOptions = serviceProvider.GetService<IOptions<CultureOptions>>().Value;
var localizationOptions = serviceProvider.GetService<IOptions<RequestLocalizationOptions>>().Value;

app.UseRequestLocalization(options =>
{
options.CultureInfoUseUserOverride = !cultureOptions.IgnoreSystemSettings;
options.SetDefaultCulture(defaultCulture);
options.AddSupportedCultures(supportedCultures);
options.AddSupportedUICultures(supportedCultures);
});
localizationOptions.CultureInfoUseUserOverride = !cultureOptions.IgnoreSystemSettings;
localizationOptions
.SetDefaultCulture(defaultCulture)
.AddSupportedCultures(supportedCultures)
.AddSupportedUICultures(supportedCultures);

app.UseRequestLocalization(localizationOptions);
}
}

Expand Down

0 comments on commit 0fa2389

Please sign in to comment.