From 297ab458c7ec8ada7b5abb1fbb358003025a427e Mon Sep 17 00:00:00 2001 From: TekH Date: Thu, 12 Feb 2026 17:16:47 +0100 Subject: [PATCH] Replace Cultures with MultiCulture and update middleware order Switched configuration and DI from Cultures to MultiCulture. Adjusted middleware registration so CultureMiddleware runs after ExceptionHandlingMiddleware. --- EnvelopeGenerator.Web/Program.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/EnvelopeGenerator.Web/Program.cs b/EnvelopeGenerator.Web/Program.cs index d21451f3..4e158971 100644 --- a/EnvelopeGenerator.Web/Program.cs +++ b/EnvelopeGenerator.Web/Program.cs @@ -165,8 +165,8 @@ try }); // Register the FlagIconCssClass instance as a singleton - builder.Services.Configure(config.GetSection("Cultures")); - builder.Services.AddSingleton(sp => sp.GetRequiredService>().Value); + builder.Services.Configure(config.GetSection("Cultures")); + builder.Services.AddSingleton(sp => sp.GetRequiredService>().Value); // Register mail services #pragma warning disable CS0618 // Type or member is obsolete @@ -187,8 +187,8 @@ try var app = builder.Build(); - app.UseMiddleware(); app.UseMiddleware(); + app.UseMiddleware(); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) @@ -230,7 +230,7 @@ try app.UseAuthentication(); app.UseAuthorization(); - var cultures = app.Services.GetRequiredService(); + var cultures = app.Services.GetRequiredService(); if (!cultures.Any()) throw new InvalidOperationException(@"Languages section is missing in the appsettings. Please configure like following. Language is both a name of the culture and the name of the resx file such as Resource.de-DE.resx