diff --git a/Components/Card.razor b/Components/Card.razor
new file mode 100644
index 0000000..f6c96ca
--- /dev/null
+++ b/Components/Card.razor
@@ -0,0 +1,7 @@
+
Card
+@typeparam TItem
+
+ @CardHeader(Item)
+ @CardBody(Item)
+ @CardFooter
+
diff --git a/Components/Card.razor.cs b/Components/Card.razor.cs
new file mode 100644
index 0000000..4e102c5
--- /dev/null
+++ b/Components/Card.razor.cs
@@ -0,0 +1,20 @@
+using Microsoft.AspNetCore.Components;
+
+namespace ProjetBlaser.Components
+{
+ public partial class Card
+ {
+ [Parameter]
+ public RenderFragment CardBody { get; set; }
+
+ [Parameter]
+ public RenderFragment CardFooter { get; set; }
+
+ [Parameter]
+ public RenderFragment CardHeader { get; set; }
+
+ [Parameter]
+ public TItem Item { get; set; }
+ }
+
+}
diff --git a/Components/CraftingAction.cs b/Components/CraftingAction.cs
new file mode 100644
index 0000000..61f5430
--- /dev/null
+++ b/Components/CraftingAction.cs
@@ -0,0 +1,11 @@
+using ProjetBlaser.Models;
+
+namespace ProjetBlaser.Components
+{
+ public class CraftingAction
+ {
+ public string Action { get; set; }
+ public int Index { get; set; }
+ public Item Item { get; set; }
+ }
+}
diff --git a/Components/CraftingRecipe.cs b/Components/CraftingRecipe.cs
new file mode 100644
index 0000000..04f9ab4
--- /dev/null
+++ b/Components/CraftingRecipe.cs
@@ -0,0 +1,10 @@
+using ProjetBlaser.Models;
+
+namespace ProjetBlaser.Components
+{
+ public class CraftingRecipe
+ {
+ public Item Give { get; set; }
+ public List> Have { get; set; }
+ }
+}
diff --git a/Components/ShowItems.razor b/Components/ShowItems.razor
new file mode 100644
index 0000000..e8fccfd
--- /dev/null
+++ b/Components/ShowItems.razor
@@ -0,0 +1,11 @@
+@typeparam TItem
+
+
+ @if ((Items?.Count ?? 0) != 0)
+ {
+ @foreach (var item in Items)
+ {
+ @ShowTemplate(item);
+ }
+ }
+
\ No newline at end of file
diff --git a/Components/ShowItems.razor.cs b/Components/ShowItems.razor.cs
new file mode 100644
index 0000000..0c8a8b2
--- /dev/null
+++ b/Components/ShowItems.razor.cs
@@ -0,0 +1,13 @@
+using Microsoft.AspNetCore.Components;
+
+namespace ProjetBlaser.Components
+{
+ public partial class ShowItems
+ {
+ [Parameter]
+ public List Items { get; set; }
+
+ [Parameter]
+ public RenderFragment ShowTemplate { get; set; }
+ }
+}
diff --git a/Components/typeparam.cs b/Components/typeparam.cs
new file mode 100644
index 0000000..1ca47ba
--- /dev/null
+++ b/Components/typeparam.cs
@@ -0,0 +1,6 @@
+namespace ProjetBlaser.Components
+{
+ internal class typeparam
+ {
+ }
+}
\ No newline at end of file
diff --git a/Controllers/CultureController.cs b/Controllers/CultureController.cs
new file mode 100644
index 0000000..dfc3066
--- /dev/null
+++ b/Controllers/CultureController.cs
@@ -0,0 +1,34 @@
+using Microsoft.AspNetCore.Localization;
+using Microsoft.AspNetCore.Mvc;
+
+namespace ProjetBlaser.Controllers
+{
+ ///
+ /// The culture controller.
+ ///
+ [Route("[controller]/[action]")]
+ public class CultureController : Controller
+ {
+ ///
+ /// Sets the culture.
+ ///
+ /// The culture.
+ /// The redirect URI.
+ ///
+ /// The action result.
+ ///
+ public IActionResult SetCulture(string culture, string redirectUri)
+ {
+ if (culture != null)
+ {
+ // Define a cookie with the selected culture
+ this.HttpContext.Response.Cookies.Append(
+ CookieRequestCultureProvider.DefaultCookieName,
+ CookieRequestCultureProvider.MakeCookieValue(
+ new RequestCulture(culture)));
+ }
+
+ return this.LocalRedirect(redirectUri);
+ }
+ }
+}
diff --git a/Models/Cake.cs b/Models/Cake.cs
new file mode 100644
index 0000000..303c717
--- /dev/null
+++ b/Models/Cake.cs
@@ -0,0 +1,9 @@
+namespace ProjetBlaser.Models
+{
+ public class Cake
+ {
+ public int Id { get; set; }
+ public string Name { get; set; }
+ public decimal Cost { get; set; }
+ }
+}
diff --git a/Pages/Index.razor b/Pages/Index.razor
index 6085c4a..7b4b9ce 100644
--- a/Pages/Index.razor
+++ b/Pages/Index.razor
@@ -1,4 +1,6 @@
@page "/"
+@using System.Globalization
+@using ProjetBlaser.Components
Index
@@ -6,4 +8,28 @@
Welcome to your new app.
+
+ CurrentCulture: @CultureInfo.CurrentCulture
+
+
+
+
+
+
+
+
@CakeContext.Name
+
Price $@CakeContext.Cost
+
+
+
+
+
+
+
+
+
diff --git a/Pages/Index.razor.cs b/Pages/Index.razor.cs
new file mode 100644
index 0000000..cde6802
--- /dev/null
+++ b/Pages/Index.razor.cs
@@ -0,0 +1,38 @@
+using ProjetBlaser.Models;
+
+namespace ProjetBlaser.Pages
+{
+ public partial class Index
+ {
+ private Cake CakeItem = new Cake
+ {
+ Id = 1,
+ Name = "Black Forest",
+ Cost = 50
+ };
+ public List Cakes { get; set; }
+
+ protected override Task OnAfterRenderAsync(bool firstRender)
+ {
+ LoadCakes();
+ StateHasChanged();
+ return base.OnAfterRenderAsync(firstRender);
+ }
+
+ public void LoadCakes()
+ {
+ Cakes = new List
+ {
+ // items hidden for display purpose
+ new Cake
+ {
+ Id = 1,
+ Name = "Red Velvet",
+ Cost = 60
+ },
+ };
+ }
+
+
+ }
+}
diff --git a/Pages/List.razor b/Pages/List.razor
index 4abdf7a..9edf758 100644
--- a/Pages/List.razor
+++ b/Pages/List.razor
@@ -1,7 +1,7 @@
@page "/list"
@using ProjetBlaser.Models
-List
+@Localizer["Title"]
Ajouter
diff --git a/Pages/List.razor.cs b/Pages/List.razor.cs
index c464bd9..75c9280 100644
--- a/Pages/List.razor.cs
+++ b/Pages/List.razor.cs
@@ -3,6 +3,7 @@ using Blazored.Modal;
using Blazored.Modal.Services;
using Blazorise.DataGrid;
using Microsoft.AspNetCore.Components;
+using Microsoft.Extensions.Localization;
using ProjetBlaser.Modals;
using ProjetBlaser.Models;
using ProjetBlaser.Services;
@@ -15,6 +16,9 @@ namespace ProjetBlaser.Pages
private int totalItem;
+ [Inject]
+ public IStringLocalizer Localizer { get; set; }
+
[Inject]
public IDataService DataService { get; set; }
diff --git a/Program.cs b/Program.cs
index 052e2f8..de12881 100644
--- a/Program.cs
+++ b/Program.cs
@@ -7,6 +7,9 @@ using Microsoft.AspNetCore.Components.Web;
using ProjetBlaser.Data;
using ProjetBlaser.Services;
using Blazored.Modal;
+using Microsoft.AspNetCore.Localization;
+using System.Globalization;
+using Microsoft.Extensions.Options;
var builder = WebApplication.CreateBuilder(args);
@@ -16,7 +19,26 @@ builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton();
builder.Services.AddHttpClient();
builder.Services.AddScoped();
+
builder.Services.AddBlazoredModal();
+
+// Add the controller of the app
+builder.Services.AddControllers();
+
+// Add the localization to the app and specify the resources path
+builder.Services.AddLocalization(opts => { opts.ResourcesPath = "Resources"; });
+
+// Configure the localtization
+builder.Services.Configure(options =>
+{
+ // Set the default culture of the web site
+ options.DefaultRequestCulture = new RequestCulture(new CultureInfo("en-US"));
+
+ // Declare the supported culture
+ options.SupportedCultures = new List { new CultureInfo("en-US"), new CultureInfo("fr-FR") };
+ options.SupportedUICultures = new List { new CultureInfo("en-US"), new CultureInfo("fr-FR") };
+});
+
builder.Services
.AddBlazorise()
.AddBootstrapProviders()
@@ -38,6 +60,22 @@ app.UseStaticFiles();
app.UseRouting();
+// Get the current localization options
+var options = ((IApplicationBuilder)app).ApplicationServices.GetService>();
+
+if (options?.Value != null)
+{
+ // use the default localization
+ app.UseRequestLocalization(options.Value);
+}
+
+// Add the controller to the endpoint
+app.UseEndpoints(endpoints =>
+{
+ endpoints.MapControllers();
+});
+
+
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
diff --git a/ProjetBlaser.csproj b/ProjetBlaser.csproj
index 64d367c..07e4a27 100644
--- a/ProjetBlaser.csproj
+++ b/ProjetBlaser.csproj
@@ -12,6 +12,22 @@
+
+
+
+
+
+ True
+ True
+ Pages.List.resx
+
+
+
+
+
+ PublicResXFileCodeGenerator
+ Pages.List.Designer.cs
+
diff --git a/Resources/Pages.List.Designer.cs b/Resources/Pages.List.Designer.cs
new file mode 100644
index 0000000..1e718eb
--- /dev/null
+++ b/Resources/Pages.List.Designer.cs
@@ -0,0 +1,72 @@
+//------------------------------------------------------------------------------
+//
+// Ce code a été généré par un outil.
+// Version du runtime :4.0.30319.42000
+//
+// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
+// le code est régénéré.
+//
+//------------------------------------------------------------------------------
+
+namespace ProjetBlaser.Resources {
+ using System;
+
+
+ ///
+ /// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées.
+ ///
+ // Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder
+ // à l'aide d'un outil, tel que ResGen ou Visual Studio.
+ // Pour ajouter ou supprimer un membre, modifiez votre fichier .ResX, puis réexécutez ResGen
+ // avec l'option /str ou régénérez votre projet VS.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ public class Pages_List {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Pages_List() {
+ }
+
+ ///
+ /// Retourne l'instance ResourceManager mise en cache utilisée par cette classe.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjetBlaser.Resources.Pages.List", typeof(Pages_List).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Remplace la propriété CurrentUICulture du thread actuel pour toutes
+ /// les recherches de ressources à l'aide de cette classe de ressource fortement typée.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Recherche une chaîne localisée semblable à Items List.
+ ///
+ public static string Title {
+ get {
+ return ResourceManager.GetString("Title", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/Resources/Pages.List.fr-FR.resx b/Resources/Pages.List.fr-FR.resx
new file mode 100644
index 0000000..50bb302
--- /dev/null
+++ b/Resources/Pages.List.fr-FR.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Liste des éléments
+
+
\ No newline at end of file
diff --git a/Resources/Pages.List.resx b/Resources/Pages.List.resx
new file mode 100644
index 0000000..ae67689
--- /dev/null
+++ b/Resources/Pages.List.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Items List
+
+
\ No newline at end of file
diff --git a/Shared/CultureSelector.razor b/Shared/CultureSelector.razor
new file mode 100644
index 0000000..0f46a4e
--- /dev/null
+++ b/Shared/CultureSelector.razor
@@ -0,0 +1,43 @@
+@using System.Globalization
+@inject NavigationManager NavigationManager
+
+
+
+
+
+@code
+{
+ private CultureInfo[] supportedCultures = new[]
+ {
+ new CultureInfo("en-US"),
+ new CultureInfo("fr-FR")
+ };
+
+ private CultureInfo Culture
+ {
+ get => CultureInfo.CurrentCulture;
+ set
+ {
+ if (CultureInfo.CurrentUICulture == value)
+ {
+ return;
+ }
+
+ var culture = value.Name.ToLower(CultureInfo.InvariantCulture);
+
+ var uri = new Uri(this.NavigationManager.Uri).GetComponents(UriComponents.PathAndQuery, UriFormat.Unescaped);
+ var query = $"?culture={Uri.EscapeDataString(culture)}&" + $"redirectUri={Uri.EscapeDataString(uri)}";
+
+ // Redirect the user to the culture controller to set the cookie
+ this.NavigationManager.NavigateTo("/Culture/SetCulture" + query, forceLoad: true);
+ }
+ }
+}
diff --git a/Shared/MainLayout.razor b/Shared/MainLayout.razor
index 955237e..3067fb3 100644
--- a/Shared/MainLayout.razor
+++ b/Shared/MainLayout.razor
@@ -10,6 +10,9 @@
diff --git a/_Imports.razor b/_Imports.razor
index abebebb..372adf2 100644
--- a/_Imports.razor
+++ b/_Imports.razor
@@ -9,3 +9,5 @@
@using ProjetBlaser
@using ProjetBlaser.Shared
@using Blazorise.DataGrid
+@using Blazored.Modal
+@using Blazored.Modal.Services
diff --git a/wwwroot/images/bamboo.png b/wwwroot/images/bamboo.png
new file mode 100644
index 0000000..a693239
Binary files /dev/null and b/wwwroot/images/bamboo.png differ
diff --git a/wwwroot/images/l'ecrevisse.png b/wwwroot/images/l'ecrevisse.png
new file mode 100644
index 0000000..4a8940d
Binary files /dev/null and b/wwwroot/images/l'ecrevisse.png differ
diff --git a/wwwroot/images/libamboo.png b/wwwroot/images/libamboo.png
new file mode 100644
index 0000000..a693239
Binary files /dev/null and b/wwwroot/images/libamboo.png differ