Skip to content

Commit

Permalink
Add request localization settings to the configured one (#14866)
Browse files Browse the repository at this point in the history
  • Loading branch information
hishamco authored and MikeAlhayek committed Jan 17, 2024
1 parent cb40f88 commit 517a9e8
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 517a9e8

Please sign in to comment.