diff options
author | 杨宇千 <crupest@outlook.com> | 2019-10-20 16:47:17 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-10-20 16:47:17 +0800 |
commit | 4c1a20746abc3354d67ffd7ef65e8639e70cd63a (patch) | |
tree | 504d77d6210fd0d0a251dcf232231d96a0990c54 /Timeline | |
parent | 9bc08731aad112f100bcbc105f2cca910948651f (diff) | |
download | timeline-4c1a20746abc3354d67ffd7ef65e8639e70cd63a.tar.gz timeline-4c1a20746abc3354d67ffd7ef65e8639e70cd63a.tar.bz2 timeline-4c1a20746abc3354d67ffd7ef65e8639e70cd63a.zip |
...
Diffstat (limited to 'Timeline')
-rw-r--r-- | Timeline/Controllers/Testing/TestingAuthController.cs (renamed from Timeline/Controllers/UserTestController.cs) | 6 | ||||
-rw-r--r-- | Timeline/Startup.cs | 16 |
2 files changed, 19 insertions, 3 deletions
diff --git a/Timeline/Controllers/UserTestController.cs b/Timeline/Controllers/Testing/TestingAuthController.cs index 2a5f36a1..488a3cff 100644 --- a/Timeline/Controllers/UserTestController.cs +++ b/Timeline/Controllers/Testing/TestingAuthController.cs @@ -2,11 +2,11 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc;
using Timeline.Authenticate;
-namespace Timeline.Controllers
+namespace Timeline.Controllers.Testing
{
- [Route("Test/User")]
+ [Route("testing/auth")]
[ApiController]
- public class UserTestController : Controller
+ public class TestingAuthController : Controller
{
[HttpGet("[action]")]
[Authorize]
diff --git a/Timeline/Startup.cs b/Timeline/Startup.cs index 72c9bf32..5718cf05 100644 --- a/Timeline/Startup.cs +++ b/Timeline/Startup.cs @@ -2,9 +2,12 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Cors.Infrastructure;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpOverrides;
+using Microsoft.AspNetCore.Localization;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
+using System.Collections.Generic;
+using System.Globalization;
using Timeline.Authenticate;
using Timeline.Configs;
using Timeline.Entities;
@@ -86,6 +89,19 @@ namespace Timeline app.UseRouting();
+ var supportedCultures = new List<CultureInfo>
+ {
+ new CultureInfo("en"),
+ new CultureInfo("zh")
+ };
+
+ app.UseRequestLocalization(new RequestLocalizationOptions
+ {
+ DefaultRequestCulture = new RequestCulture("en"),
+ SupportedCultures = supportedCultures,
+ SupportedUICultures = supportedCultures
+ });
+
app.UseCors();
app.UseAuthentication();
|