newBranch
Victor Perez NGOUNOU 2 years ago
parent 11aa501e71
commit 620cd0ff38

BIN
.DS_Store vendored

Binary file not shown.

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/modules.xml
/projectSettingsUpdater.xml
/contentModel.xml
/.idea.TP Blazor.iml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,35 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/TP Blazor/bin/Debug/net7.0/TP Blazor.dll",
"args": [],
"cwd": "${workspaceFolder}/TP Blazor",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}

@ -1,9 +1,32 @@
@page "/" @page "/"
@using System.Globalization
@using TP_Blazor.Components
<PageTitle>Index</PageTitle> <PageTitle>Index</PageTitle>
<h1>Hello, world!</h1> <h1>Hello, world!</h1>
<p>
<b>CurrentCulture</b>: @CultureInfo.CurrentCulture
</p>
<Card Item="CakeItem">
<CardHeader>
<div class="card-header">
Cake Token number - @context.Id
</div>
</CardHeader>
<CardBody>
<div class="card-body">
<div>@context.Name</div>
<div>$@context.Cost</div>
</div>
</CardBody>
<CardFooter>
<div class="card-footer text-muted">
this is footer
</div>
</CardFooter>
</Card>
Welcome to your new app.
<SurveyPrompt Title="How is Blazor working for you?" /> <SurveyPrompt Title="How is Blazor working for you?" />

@ -1,3 +1,4 @@
using System.Globalization;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.Web;
using TP_Blazor.Data; using TP_Blazor.Data;
@ -6,6 +7,10 @@ using Blazorise.Icons.FontAwesome;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Blazorise.Bootstrap; using Blazorise.Bootstrap;
using Blazored.LocalStorage; using Blazored.LocalStorage;
using TP_Blazor.Services;
using Blazored.Modal;
using Microsoft.AspNetCore.Localization;
using Microsoft.Extensions.Options;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
@ -18,6 +23,17 @@ builder.Services.AddBlazorise()
.AddBootstrapProviders() .AddBootstrapProviders()
.AddBlazoredLocalStorage() .AddBlazoredLocalStorage()
.AddFontAwesomeIcons(); .AddFontAwesomeIcons();
builder.Services.AddBlazoredLocalStorage();
builder.Services.AddBlazoredModal();
builder.Services.AddControllers();
builder.Services.AddLocalization(opt=>{opt.ResourcesPath="Ressources";});
builder.Services.Configure<RequestLocalizationOptions>(option =>
{
option.DefaultRequestCulture = new RequestCulture(new CultureInfo("en-US"));
option.SupportedCultures = new List<CultureInfo> { new CultureInfo("en-US"), new CultureInfo("fr-FR") };
option.SupportedUICultures = new List<CultureInfo> { new CultureInfo("en-US"), new CultureInfo("fr-FR") };
});
builder.Services.AddScoped<IDataService, DataLocalService>();
var app = builder.Build(); var app = builder.Build();
@ -32,6 +48,18 @@ app.UseStaticFiles();
app.UseRouting(); app.UseRouting();
var options =((IApplicationBuilder)app).ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>();
if (options?.Value != null)
{
app.UseRequestLocalization(options.Value);
}
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
app.MapBlazorHub(); app.MapBlazorHub();
app.MapFallbackToPage("/_Host"); app.MapFallbackToPage("/_Host");

Binary file not shown.
Loading…
Cancel
Save