Hinzufügen einer Cookie-basierten Sprachauswahl zum Front-End

This commit is contained in:
Developer 02
2024-05-06 17:38:45 +02:00
parent a285a0b9c2
commit 79aa6f4cb3
403 changed files with 58268 additions and 20 deletions

View File

@@ -14,7 +14,6 @@ using Microsoft.AspNetCore.Authentication.Cookies;
using DigitalData.UserManager.Application.MappingProfiles;
using EnvelopeGenerator.Web.Models;
using DigitalData.Core.DTO;
using Microsoft.Extensions.Localization;
var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger();
logger.Info("Logging initialized!");
@@ -174,7 +173,12 @@ try
app.UseAuthentication();
app.UseAuthorization();
app.UseCookieBasedLocalizer("de_DE", "en_US");
var languages = builder.Configuration.GetSection("Languages").Get<string[]>() ??
throw new InvalidOperationException("Languages section is missing in the configuration.");
if(languages.Length == 0)
throw new InvalidOperationException("There is no languages in languages section.");
app.UseCookieBasedLocalizer(languages);
app.UseCors("SameOriginPolicy");