diff --git a/src/DotNetCore.CAP.Dashboard/CAP.DashboardMiddleware.cs b/src/DotNetCore.CAP.Dashboard/CAP.DashboardMiddleware.cs index c8d5e92..d584b2f 100644 --- a/src/DotNetCore.CAP.Dashboard/CAP.DashboardMiddleware.cs +++ b/src/DotNetCore.CAP.Dashboard/CAP.DashboardMiddleware.cs @@ -2,12 +2,13 @@ // Licensed under the MIT License. See License.txt in the project root for license information. using System; -using System.Linq; +using System.Globalization; using System.Net; using System.Threading.Tasks; using DotNetCore.CAP.Dashboard; using DotNetCore.CAP.Dashboard.GatewayProxy; using DotNetCore.CAP.Dashboard.NodeDiscovery; +using DotNetCore.CAP.Dashboard.Resources; using DotNetCore.CAP.Persistence; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -36,7 +37,6 @@ namespace DotNetCore.CAP { app.UseMiddleware(); } - app.UseMiddleware(); } @@ -77,7 +77,7 @@ namespace DotNetCore.CAP app.UseCapDashboard(); next(app); - }; + }; } } @@ -106,6 +106,9 @@ namespace DotNetCore.CAP return; } + var userLanguages = context.Request.Headers["Accept-Language"].ToString(); + Strings.Culture = userLanguages.Contains("zh-") ? new CultureInfo("zh-CN") : new CultureInfo("en-US"); + // Update the path var path = context.Request.Path; var pathBase = context.Request.PathBase;