SHA256
GuestLog - Localization - Initial Implementation
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using FluentValidation;
|
||||
using Microsoft.AspNetCore.Localization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using MudBlazor.Services;
|
||||
using Somnia.GuestLog.Components;
|
||||
@@ -30,6 +31,9 @@ builder.Services.AddSingleton<IValidator<GuestDocumentDTO>, GuestDocumentDTOVali
|
||||
|
||||
// Add Services
|
||||
builder.Services.AddSingleton<IGuestDocumentService, GuestDocumentService>();
|
||||
builder.Services.AddSingleton<IDataListService, StaticDataListService>();
|
||||
|
||||
builder.Services.AddLocalization();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
@@ -49,6 +53,17 @@ app.UseHttpsRedirection();
|
||||
|
||||
app.UseAntiforgery();
|
||||
|
||||
string[] supportedCultures = ["en-US", "es-ES"];
|
||||
var localizationOptions = new RequestLocalizationOptions()
|
||||
.SetDefaultCulture(supportedCultures[0])
|
||||
.AddSupportedCultures(supportedCultures)
|
||||
.AddSupportedUICultures(supportedCultures);
|
||||
localizationOptions.RequestCultureProviders = [
|
||||
new QueryStringRequestCultureProvider(),
|
||||
new CookieRequestCultureProvider()
|
||||
];
|
||||
|
||||
app.UseRequestLocalization(localizationOptions);
|
||||
app.MapStaticAssets();
|
||||
app.MapRazorComponents<App>()
|
||||
.AddInteractiveServerRenderMode();
|
||||
|
||||
Reference in New Issue
Block a user