Pārlūkot izejas kodu

Fix browser language detection. #631

master
Savorboard pirms 4 gadiem
vecāks
revīzija
80c76ed52f
1 mainītis faili ar 6 papildinājumiem un 3 dzēšanām
  1. +6
    -3
      src/DotNetCore.CAP.Dashboard/CAP.DashboardMiddleware.cs

+ 6
- 3
src/DotNetCore.CAP.Dashboard/CAP.DashboardMiddleware.cs Parādīt failu

@@ -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<GatewayProxyMiddleware>();
}

app.UseMiddleware<DashboardMiddleware>();
}

@@ -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;


Notiek ielāde…
Atcelt
Saglabāt