diff --git a/CleanArchitecture.Razor.sln b/CleanArchitecture.Razor.sln
index 5f4a7909..cbca8015 100644
--- a/CleanArchitecture.Razor.sln
+++ b/CleanArchitecture.Razor.sln
@@ -24,7 +24,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SmartAdmin.WebUI", "src\Sma
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{6BD2EC46-FA8F-44F3-AF33-903BBB347116}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Workflow", "src\Workflow\Workflow.csproj", "{A5A249F5-C62B-4F0E-9715-F8C65D37ACD3}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Workflow", "src\Workflow\Workflow.csproj", "{A5A249F5-C62B-4F0E-9715-F8C65D37ACD3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/src/Infrastructure/Constants/Localization/LocalizationConstants.cs b/src/Infrastructure/Constants/Localization/LocalizationConstants.cs
new file mode 100644
index 00000000..269890e0
--- /dev/null
+++ b/src/Infrastructure/Constants/Localization/LocalizationConstants.cs
@@ -0,0 +1,34 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CleanArchitecture.Razor.Infrastructure.Constants.Localization
+{
+ public static class LocalizationConstants
+ {
+ public static readonly LanguageCode[] SupportedLanguages = {
+ new LanguageCode
+ {
+ Code = "en-US",
+ DisplayName= "English"
+ },
+
+ new LanguageCode
+ {
+ Code = "zh-CN",
+ DisplayName = "中文"
+ }
+ };
+ }
+
+ public class LanguageCode
+ {
+ public string DisplayName { get; set; }
+ public string Code { get; set; }
+ }
+}
diff --git a/src/SmartAdmin.WebUI/Areas/Identity/Pages/_PageHeader.cshtml b/src/SmartAdmin.WebUI/Areas/Identity/Pages/_PageHeader.cshtml
index 3b7fcca0..52fc775b 100644
--- a/src/SmartAdmin.WebUI/Areas/Identity/Pages/_PageHeader.cshtml
+++ b/src/SmartAdmin.WebUI/Areas/Identity/Pages/_PageHeader.cshtml
@@ -1,4 +1,5 @@
-@{
+@inject Microsoft.AspNetCore.Mvc.Localization.IViewLocalizer _localizer
+@{
var pageName = ViewBag.PageName ?? string.Empty;
var canLogin = new string[] { "register", "forgotpassword", "lockout", "logout" }.ToList().Contains(pageName);
}
@@ -8,17 +9,17 @@
@if (canLogin)
{
- Already a member?
+ @_localizer["Already a member?"]
- Secure Login
+ @_localizer["Secure Login"]
}
else
{
-
- Register account
-
+
+ @_localizer["Register account"]
+
}
-
\ No newline at end of file
+
diff --git a/src/SmartAdmin.WebUI/Extensions/RequestLocalizationCookiesMiddlewareExtensions.cs b/src/SmartAdmin.WebUI/Extensions/RequestLocalizationCookiesMiddlewareExtensions.cs
new file mode 100644
index 00000000..3854b1e7
--- /dev/null
+++ b/src/SmartAdmin.WebUI/Extensions/RequestLocalizationCookiesMiddlewareExtensions.cs
@@ -0,0 +1,60 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Localization;
+using Microsoft.Extensions.Options;
+
+namespace SmartAdmin.WebUI.Extensions
+{
+ public static class RequestLocalizationCookiesMiddlewareExtensions
+ {
+ public static IApplicationBuilder UseRequestLocalizationCookies(this IApplicationBuilder app)
+ {
+ app.UseMiddleware();
+ return app;
+ }
+ }
+
+ public class RequestLocalizationCookiesMiddleware : IMiddleware
+ {
+ public CookieRequestCultureProvider Provider { get; }
+
+ public RequestLocalizationCookiesMiddleware(IOptions requestLocalizationOptions)
+ {
+ Provider =
+ requestLocalizationOptions
+ .Value
+ .RequestCultureProviders
+ .Where(x => x is CookieRequestCultureProvider)
+ .Cast()
+ .FirstOrDefault();
+ }
+
+ public async Task InvokeAsync(HttpContext context, RequestDelegate next)
+ {
+ if (Provider != null)
+ {
+ var feature = context.Features.Get();
+
+ if (feature != null)
+ {
+ // remember culture across request
+ context.Response
+ .Cookies
+ .Append(
+ Provider.CookieName,
+ CookieRequestCultureProvider.MakeCookieValue(feature.RequestCulture)
+ );
+ }
+ }
+
+ await next(context);
+ }
+ }
+}
diff --git a/src/SmartAdmin.WebUI/Pages/Shared/Components/LanguageSelector/Default.cshtml b/src/SmartAdmin.WebUI/Pages/Shared/Components/LanguageSelector/Default.cshtml
new file mode 100644
index 00000000..c23aa760
--- /dev/null
+++ b/src/SmartAdmin.WebUI/Pages/Shared/Components/LanguageSelector/Default.cshtml
@@ -0,0 +1,11 @@
+@model SmartAdmin.WebUI.Pages.Shared.Components.LanguageSelector.DefaultModel
+
+
diff --git a/src/SmartAdmin.WebUI/Pages/Shared/Components/LanguageSelector/Default.cshtml.cs b/src/SmartAdmin.WebUI/Pages/Shared/Components/LanguageSelector/Default.cshtml.cs
new file mode 100644
index 00000000..a95a245c
--- /dev/null
+++ b/src/SmartAdmin.WebUI/Pages/Shared/Components/LanguageSelector/Default.cshtml.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Threading.Tasks;
+using CleanArchitecture.Razor.Infrastructure.Constants.Localization;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.RazorPages;
+
+namespace SmartAdmin.WebUI.Pages.Shared.Components.LanguageSelector
+{
+
+ public class DefaultModel
+ {
+ public CultureInfo CurrentUICulture { get; set; }
+ public List SupportedCultures { get; set; }
+ }
+
+}
diff --git a/src/SmartAdmin.WebUI/Pages/Shared/_DropdownMenu.cshtml b/src/SmartAdmin.WebUI/Pages/Shared/_DropdownMenu.cshtml
index 07e525dd..b5506f7e 100644
--- a/src/SmartAdmin.WebUI/Pages/Shared/_DropdownMenu.cshtml
+++ b/src/SmartAdmin.WebUI/Pages/Shared/_DropdownMenu.cshtml
@@ -1,45 +1,40 @@
-