Hinzufügen einer Cookie-basierten Sprachauswahl zum Front-End
This commit is contained in:
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user