Created
January 16, 2024 08:43
-
-
Save FacileTechnolab/61e553703411f5e8a9199848f6c6b866 to your computer and use it in GitHub Desktop.
BlazorAppPart3/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BlazorAppPart3.Components; | |
var builder = WebApplication.CreateBuilder(args); | |
builder.Services.AddLocalization(); | |
builder.Services.AddControllers(); | |
// Add services to the container. | |
builder.Services.AddRazorComponents() | |
.AddInteractiveServerComponents(); | |
var app = builder.Build(); | |
string[] supportedCultures = ["en-US", "es-ES"]; | |
var localizationOptions = new RequestLocalizationOptions() | |
.SetDefaultCulture(supportedCultures[0]) | |
.AddSupportedCultures(supportedCultures) | |
.AddSupportedUICultures(supportedCultures); | |
app.UseRequestLocalization(localizationOptions); | |
// Configure the HTTP request pipeline. | |
if (!app.Environment.IsDevelopment()) | |
{ | |
app.UseExceptionHandler("/Error", createScopeForErrors: true); | |
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. | |
app.UseHsts(); | |
} | |
app.UseHttpsRedirection(); | |
app.UseStaticFiles(); | |
app.UseRouting(); | |
app.UseAntiforgery(); | |
app.MapControllers(); | |
app.MapRazorComponents<App>() | |
.AddInteractiveServerRenderMode(); | |
app.Run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment