From 620cd0ff38888a442bde207fe5e284e03dfc05a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20P=C3=A9rez=20Ngounou?= Date: Mon, 23 Jan 2023 13:59:27 +0100 Subject: [PATCH] commit --- .DS_Store | Bin 0 -> 6148 bytes .idea/.idea.TP Blazor/.idea/.gitignore | 13 +++++++++ .idea/.idea.TP Blazor/.idea/.name | 1 + .vscode/launch.json | 35 +++++++++++++++++++++++++ TP Blazor/Pages/Index.razor | 25 +++++++++++++++++- TP Blazor/Program.cs | 28 ++++++++++++++++++++ TP Blazor/wwwroot/images/.DS_Store | Bin 0 -> 6148 bytes 7 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 .DS_Store create mode 100644 .idea/.idea.TP Blazor/.idea/.gitignore create mode 100644 .idea/.idea.TP Blazor/.idea/.name create mode 100644 .vscode/launch.json create mode 100644 TP Blazor/wwwroot/images/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0Index

Hello, world!

+

+ CurrentCulture: @CultureInfo.CurrentCulture +

+ + + +
+ Cake Token number - @context.Id +
+
+ +
+
@context.Name
+
$@context.Cost
+
+
+ + + +
-Welcome to your new app. diff --git a/TP Blazor/Program.cs b/TP Blazor/Program.cs index 371def7..41c3fd8 100644 --- a/TP Blazor/Program.cs +++ b/TP Blazor/Program.cs @@ -1,3 +1,4 @@ +using System.Globalization; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using TP_Blazor.Data; @@ -6,6 +7,10 @@ using Blazorise.Icons.FontAwesome; using Microsoft.Extensions.DependencyInjection; using Blazorise.Bootstrap; using Blazored.LocalStorage; +using TP_Blazor.Services; +using Blazored.Modal; +using Microsoft.AspNetCore.Localization; +using Microsoft.Extensions.Options; var builder = WebApplication.CreateBuilder(args); @@ -18,6 +23,17 @@ builder.Services.AddBlazorise() .AddBootstrapProviders() .AddBlazoredLocalStorage() .AddFontAwesomeIcons(); +builder.Services.AddBlazoredLocalStorage(); +builder.Services.AddBlazoredModal(); +builder.Services.AddControllers(); +builder.Services.AddLocalization(opt=>{opt.ResourcesPath="Ressources";}); +builder.Services.Configure(option => +{ + option.DefaultRequestCulture = new RequestCulture(new CultureInfo("en-US")); + option.SupportedCultures = new List { new CultureInfo("en-US"), new CultureInfo("fr-FR") }; + option.SupportedUICultures = new List { new CultureInfo("en-US"), new CultureInfo("fr-FR") }; +}); +builder.Services.AddScoped(); var app = builder.Build(); @@ -32,6 +48,18 @@ app.UseStaticFiles(); app.UseRouting(); +var options =((IApplicationBuilder)app).ApplicationServices.GetService>(); + +if (options?.Value != null) +{ + app.UseRequestLocalization(options.Value); +} + +app.UseEndpoints(endpoints => +{ + endpoints.MapControllers(); +}); + app.MapBlazorHub(); app.MapFallbackToPage("/_Host"); diff --git a/TP Blazor/wwwroot/images/.DS_Store b/TP Blazor/wwwroot/images/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0