From 1a6462dc73653d036c7d78b4719cbc1e7f8af01c Mon Sep 17 00:00:00 2001 From: arvalin Date: Sat, 26 Nov 2022 08:24:39 +0100 Subject: [PATCH 1/3] Add ressource files --- .../Controllers/CultureController.cs | 31 ++++ src/CraftSharp/CraftSharp.csproj | 3 +- src/CraftSharp/CraftSharp.sln | 50 +++---- src/CraftSharp/Program.cs | 37 ++++- .../Resources/Pages.List.fr-FR.resx | 135 ++++++++++++++++++ src/CraftSharp/Resources/Pages.List.resx | 135 ++++++++++++++++++ .../Resources/Pages.List.tr-TR.resx | 135 ++++++++++++++++++ src/CraftSharp/Shared/CultureSelector.razor | 44 ++++++ src/CraftSharp/Shared/MainLayout.razor | 4 +- 9 files changed, 546 insertions(+), 28 deletions(-) create mode 100644 src/CraftSharp/Controllers/CultureController.cs create mode 100644 src/CraftSharp/Resources/Pages.List.fr-FR.resx create mode 100644 src/CraftSharp/Resources/Pages.List.resx create mode 100644 src/CraftSharp/Resources/Pages.List.tr-TR.resx create mode 100644 src/CraftSharp/Shared/CultureSelector.razor diff --git a/src/CraftSharp/Controllers/CultureController.cs b/src/CraftSharp/Controllers/CultureController.cs new file mode 100644 index 0000000..7db1cda --- /dev/null +++ b/src/CraftSharp/Controllers/CultureController.cs @@ -0,0 +1,31 @@ +using Microsoft.AspNetCore.Localization; +using Microsoft.AspNetCore.Mvc; + +namespace CraftSharp.Controllers +{ + [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/src/CraftSharp/CraftSharp.csproj b/src/CraftSharp/CraftSharp.csproj index a53aa86..c9d13da 100644 --- a/src/CraftSharp/CraftSharp.csproj +++ b/src/CraftSharp/CraftSharp.csproj @@ -1,4 +1,4 @@ - + net6.0 @@ -10,6 +10,7 @@ + diff --git a/src/CraftSharp/CraftSharp.sln b/src/CraftSharp/CraftSharp.sln index 5b7bccb..e30afcd 100644 --- a/src/CraftSharp/CraftSharp.sln +++ b/src/CraftSharp/CraftSharp.sln @@ -1,25 +1,25 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.3.32929.385 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CraftSharp", "CraftSharp.csproj", "{C299F384-0C85-4A98-998B-D2704C557CC0}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C299F384-0C85-4A98-998B-D2704C557CC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C299F384-0C85-4A98-998B-D2704C557CC0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C299F384-0C85-4A98-998B-D2704C557CC0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C299F384-0C85-4A98-998B-D2704C557CC0}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {7E596F12-053A-4BAD-B71D-8EFE6B3C7C2F} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32929.385 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CraftSharp", "CraftSharp.csproj", "{C299F384-0C85-4A98-998B-D2704C557CC0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C299F384-0C85-4A98-998B-D2704C557CC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C299F384-0C85-4A98-998B-D2704C557CC0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C299F384-0C85-4A98-998B-D2704C557CC0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C299F384-0C85-4A98-998B-D2704C557CC0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7E596F12-053A-4BAD-B71D-8EFE6B3C7C2F} + EndGlobalSection +EndGlobal diff --git a/src/CraftSharp/Program.cs b/src/CraftSharp/Program.cs index 9a940f5..1390d26 100644 --- a/src/CraftSharp/Program.cs +++ b/src/CraftSharp/Program.cs @@ -1,7 +1,10 @@ using CraftSharp.Data; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; - +using Microsoft.AspNetCore.Localization; +using Microsoft.Extensions.Options; +using System.Globalization; + var builder = WebApplication.CreateBuilder(args); // Add services to the container. @@ -9,6 +12,23 @@ builder.Services.AddRazorPages(); builder.Services.AddServerSideBlazor(); builder.Services.AddSingleton(); +// 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"), new CultureInfo("tr-TR") }; + options.SupportedUICultures = new List { new CultureInfo("en-US"), new CultureInfo("fr-FR"), new CultureInfo("tr-TR") }; +}); + var app = builder.Build(); // Configure the HTTP request pipeline. @@ -25,6 +45,21 @@ 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/src/CraftSharp/Resources/Pages.List.fr-FR.resx b/src/CraftSharp/Resources/Pages.List.fr-FR.resx new file mode 100644 index 0000000..aace2a0 --- /dev/null +++ b/src/CraftSharp/Resources/Pages.List.fr-FR.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + Inventaire + + + Se connecter + + + Ouverture + + + Créer un compte + + + Magasin + + \ No newline at end of file diff --git a/src/CraftSharp/Resources/Pages.List.resx b/src/CraftSharp/Resources/Pages.List.resx new file mode 100644 index 0000000..fe08772 --- /dev/null +++ b/src/CraftSharp/Resources/Pages.List.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + Inventory + + + Login + + + Opening + + + Register + + + Shop + + \ No newline at end of file diff --git a/src/CraftSharp/Resources/Pages.List.tr-TR.resx b/src/CraftSharp/Resources/Pages.List.tr-TR.resx new file mode 100644 index 0000000..8c050d1 --- /dev/null +++ b/src/CraftSharp/Resources/Pages.List.tr-TR.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + Envanter + + + Giriş yapmak + + + Açılış + + + Kayıt ol + + + Mağaza + + \ No newline at end of file diff --git a/src/CraftSharp/Shared/CultureSelector.razor b/src/CraftSharp/Shared/CultureSelector.razor new file mode 100644 index 0000000..ddca085 --- /dev/null +++ b/src/CraftSharp/Shared/CultureSelector.razor @@ -0,0 +1,44 @@ +@using System.Globalization +@inject NavigationManager NavigationManager + +

+ +

+ +@code +{ + private CultureInfo[] supportedCultures = new[] + { + new CultureInfo("en-US"), + new CultureInfo("fr-FR"), + new CultureInfo("tr-TR") + }; + + 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); + } + } +} \ No newline at end of file diff --git a/src/CraftSharp/Shared/MainLayout.razor b/src/CraftSharp/Shared/MainLayout.razor index 78a06ec..798e5ac 100644 --- a/src/CraftSharp/Shared/MainLayout.razor +++ b/src/CraftSharp/Shared/MainLayout.razor @@ -11,7 +11,9 @@ - +
+ +
@Body
From 33dad55c14f087c6dbc3af2d3613daf7bc637e03 Mon Sep 17 00:00:00 2001 From: arvalin Date: Sat, 26 Nov 2022 08:32:03 +0100 Subject: [PATCH 2/3] Add subtext images --- src/CraftSharp/wwwroot/images/subtext_en-EN.png | Bin 0 -> 2301 bytes src/CraftSharp/wwwroot/images/subtext_fr-FR.png | Bin 0 -> 2641 bytes src/CraftSharp/wwwroot/images/subtext_tr_TR.png | Bin 0 -> 2361 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/CraftSharp/wwwroot/images/subtext_en-EN.png create mode 100644 src/CraftSharp/wwwroot/images/subtext_fr-FR.png create mode 100644 src/CraftSharp/wwwroot/images/subtext_tr_TR.png diff --git a/src/CraftSharp/wwwroot/images/subtext_en-EN.png b/src/CraftSharp/wwwroot/images/subtext_en-EN.png new file mode 100644 index 0000000000000000000000000000000000000000..d65ec4d1340890f8595266094e5475c4cf54e049 GIT binary patch literal 2301 zcma)8dpy%^8~<&?oaWe*(ppiYgHw3sSC+CCBj&7^SZQSr9abWzFoa$YMJcq9CK7Wj z$837AqEX5z@+^lIlFytEOV7{i{p0<-|2*A)T=#W=cZfU+VH z9RWas4)IiJ1Vo$iknK(m+V-PaEAJ4)mqHerG|V;IlnBxqu@HIoq5jS#st39u zPy$|sKbWqo;4X9@4!?E|zvC1|FLVk2X7-lK!18FL)04f;*Tt>A@|VIrW~W2a$273j zb8WHLsV^f!YDJf)j41$GQSC)I#ygZGa{-2qIwJFVBNqnVQGy776xb80CFy_yHueO7 zRD&tJ)Qv*WcWDfa55~S8Yf)Vv7#ev!ngIf3ibI}}l!vF_z=noLOt^2aJK1?<1b z%QoY{nf8LB2OAY*`h4-PTwqLREpVAO^X}C0qGlBUQXE>Rl6zOD0}bT1eJKRUNN&x3 zKnNG46L)8$jaeLtxSBmsxC9kVEPzzT60HFR2Lek%p!6S>t6`mR2SDe>l4PKH6J=6V zjtJhYhX1S;KlTBbSxm9P1Aj*v%THY$8?v!D9=9*&XvFE_R-9vF%fHwokLgaAIWBQH zQbj}RhA$=vvO|3&rNIY4mz2CSO-kbY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K1^Ar5iA~RpPZ;A$l1@uBuQ)<{@Cj9y90zUZS$}^a-})j6 zNMP}M0x>!?5_vJ3B!>Cw0tcv=@R|*$twIKat_rR>PX=eZ<3L={h~>btpN(Uv4(aX|^v7G(pgW77V1D~pEX38; zU@-=T%N8XR3#7| z`q>|_FI91-+N_p5y4b*@-dSXd&gI{aiMQRt;3Z0Y#DZ-NLEXa~6e7i1sXi|K)lQuH z+Gg)aws=-%A5f@t7b7v&DQCAT%x8cSd+QddH#4rOAd$kHUA=!aYc?SKk&< zn_%*|SRf8t9Lhd9zY@dgntoa#Te0Bay+UQ3KX=Ts$j{VvUk5QZP10SOZ`}NnK23c> zakp8T+KhcG8R8l7$M(O!p1JRem|E*QwTh72?$d{u=vsvx(F9bupZ`GLocGW5)Hw^h zw$~=<@6swbYF@;)i_sJy3O==KF|;R< zrIWtHxqLcj%asYxPV}Ukz3@5{+OHOIFT literal 0 HcmV?d00001 diff --git a/src/CraftSharp/wwwroot/images/subtext_tr_TR.png b/src/CraftSharp/wwwroot/images/subtext_tr_TR.png new file mode 100644 index 0000000000000000000000000000000000000000..96c0d506e3a4404c1fde05ceb5241ab5a0ef69e2 GIT binary patch literal 2361 zcma)7dpJ~U7oQ3Zh9<=1HVqM7#&DQPF2zuM7>?_>4C3&`Haul20o+P}5en`TEiAt5F&27y2% zEG^9JArK(|#6;*eaDVV0SOR#MA`NYKIM#10!{iJDC1XEarAt42FT!3%t+5@AnpfG~_@ z302DK+~e)pb&}4E1%LEV@6eF*#i$1frM+BiUExrtJq`ka>RXzbIL5H&ir++yU}enx z++=Dl6)+ArDB*&pQUi{B+vMtzSyCM$GSEecVq+!TsRh0EtT zU$8opeaz6M!qu2IYe%Z8?`2KTziaw@)g|sS(&NzG0AkhyKi#W5>VUCJkyd+)ZiwWr z<_Vq?R=Dfa{S0*n(p@%}*PThD#QJ`C92)tcBzY>v{dit=t?QgLED0q9(BX)!ct<&K z^M)p&FaiThSYS2vhJp?lv&iCUV~QLOs14DS!KB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8A<84~8!lh?42$ zj%VM+nW{xDGEz}%FOO*j^WS_3uAOqpeck@)I^X1gEj&a4xa?PWqX&rJgH9eI> z1$T7p^)=GNkJ;u5ajL*U+1LNed?*6zA+L?g-W#1$&qLZ(bZje pRo>%AVXwrTaZ=w;d{ZcGcvUVei1@gO+=hXG%hH@+R%_~={15p@{z?D< literal 0 HcmV?d00001 From b693ad48c1e5a80ee32c91df788ff854488ea15a Mon Sep 17 00:00:00 2001 From: arvalin Date: Sat, 26 Nov 2022 09:08:59 +0100 Subject: [PATCH 3/3] make use of resources --- src/CraftSharp/Pages/Index.razor | 7 +++++++ src/CraftSharp/Pages/Index.razor.cs | 11 +++++++++++ ...Pages.List.fr-FR.resx => Pages.Index.fr-FR.resx} | 3 +++ .../Resources/{Pages.List.resx => Pages.Index.resx} | 3 +++ ...Pages.List.tr-TR.resx => Pages.Index.tr-TR.resx} | 3 +++ src/CraftSharp/Shared/MainLayout.razor | 9 ++++++--- .../images/{subtext_tr_TR.png => subtext_tr-TR.png} | Bin 7 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 src/CraftSharp/Pages/Index.razor.cs rename src/CraftSharp/Resources/{Pages.List.fr-FR.resx => Pages.Index.fr-FR.resx} (96%) rename src/CraftSharp/Resources/{Pages.List.resx => Pages.Index.resx} (96%) rename src/CraftSharp/Resources/{Pages.List.tr-TR.resx => Pages.Index.tr-TR.resx} (96%) rename src/CraftSharp/wwwroot/images/{subtext_tr_TR.png => subtext_tr-TR.png} (100%) diff --git a/src/CraftSharp/Pages/Index.razor b/src/CraftSharp/Pages/Index.razor index 6085c4a..873f213 100644 --- a/src/CraftSharp/Pages/Index.razor +++ b/src/CraftSharp/Pages/Index.razor @@ -1,8 +1,15 @@ @page "/" +@using System.Globalization +

+ CurrentCulture: @CultureInfo.CurrentCulture +

Index + +

@Localizer["Opening"]

Hello, world!

+ Welcome to your new app. diff --git a/src/CraftSharp/Pages/Index.razor.cs b/src/CraftSharp/Pages/Index.razor.cs new file mode 100644 index 0000000..4b50d5e --- /dev/null +++ b/src/CraftSharp/Pages/Index.razor.cs @@ -0,0 +1,11 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Localization; + +namespace CraftSharp.Pages +{ + public partial class Index + { + [Inject] + public IStringLocalizer Localizer { get; set; } + } +} diff --git a/src/CraftSharp/Resources/Pages.List.fr-FR.resx b/src/CraftSharp/Resources/Pages.Index.fr-FR.resx similarity index 96% rename from src/CraftSharp/Resources/Pages.List.fr-FR.resx rename to src/CraftSharp/Resources/Pages.Index.fr-FR.resx index aace2a0..238a0f5 100644 --- a/src/CraftSharp/Resources/Pages.List.fr-FR.resx +++ b/src/CraftSharp/Resources/Pages.Index.fr-FR.resx @@ -132,4 +132,7 @@ Magasin + + subtext_fr-FR + \ No newline at end of file diff --git a/src/CraftSharp/Resources/Pages.List.resx b/src/CraftSharp/Resources/Pages.Index.resx similarity index 96% rename from src/CraftSharp/Resources/Pages.List.resx rename to src/CraftSharp/Resources/Pages.Index.resx index fe08772..d975e18 100644 --- a/src/CraftSharp/Resources/Pages.List.resx +++ b/src/CraftSharp/Resources/Pages.Index.resx @@ -132,4 +132,7 @@ Shop + + subtext_en-EN + \ No newline at end of file diff --git a/src/CraftSharp/Resources/Pages.List.tr-TR.resx b/src/CraftSharp/Resources/Pages.Index.tr-TR.resx similarity index 96% rename from src/CraftSharp/Resources/Pages.List.tr-TR.resx rename to src/CraftSharp/Resources/Pages.Index.tr-TR.resx index 8c050d1..9468275 100644 --- a/src/CraftSharp/Resources/Pages.List.tr-TR.resx +++ b/src/CraftSharp/Resources/Pages.Index.tr-TR.resx @@ -132,4 +132,7 @@ Mağaza + + subtext_tr-TR + \ No newline at end of file diff --git a/src/CraftSharp/Shared/MainLayout.razor b/src/CraftSharp/Shared/MainLayout.razor index 798e5ac..b3e8948 100644 --- a/src/CraftSharp/Shared/MainLayout.razor +++ b/src/CraftSharp/Shared/MainLayout.razor @@ -2,6 +2,7 @@ CraftSharp +