Browse Source

Fix browser language detection. #631

master
Savorboard 4 years ago
parent
commit
80c76ed52f
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      src/DotNetCore.CAP.Dashboard/CAP.DashboardMiddleware.cs

+ 6
- 3
src/DotNetCore.CAP.Dashboard/CAP.DashboardMiddleware.cs View File

@@ -2,12 +2,13 @@
// Licensed under the MIT License. See License.txt in the project root for license information. // Licensed under the MIT License. See License.txt in the project root for license information.


using System; using System;
using System.Linq;
using System.Globalization;
using System.Net; using System.Net;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Dashboard; using DotNetCore.CAP.Dashboard;
using DotNetCore.CAP.Dashboard.GatewayProxy; using DotNetCore.CAP.Dashboard.GatewayProxy;
using DotNetCore.CAP.Dashboard.NodeDiscovery; using DotNetCore.CAP.Dashboard.NodeDiscovery;
using DotNetCore.CAP.Dashboard.Resources;
using DotNetCore.CAP.Persistence; using DotNetCore.CAP.Persistence;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
@@ -36,7 +37,6 @@ namespace DotNetCore.CAP
{ {
app.UseMiddleware<GatewayProxyMiddleware>(); app.UseMiddleware<GatewayProxyMiddleware>();
} }

app.UseMiddleware<DashboardMiddleware>(); app.UseMiddleware<DashboardMiddleware>();
} }


@@ -77,7 +77,7 @@ namespace DotNetCore.CAP
app.UseCapDashboard(); app.UseCapDashboard();


next(app); next(app);
};
};
} }
} }


@@ -106,6 +106,9 @@ namespace DotNetCore.CAP
return; 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 // Update the path
var path = context.Request.Path; var path = context.Request.Path;
var pathBase = context.Request.PathBase; var pathBase = context.Request.PathBase;


Loading…
Cancel
Save