React to aspnet/Localization#111
This commit is contained in:
parent
4e8c543489
commit
9658060019
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Localization;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNet.Mvc.Razor;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
|
@ -38,7 +39,7 @@ namespace MvcSample.Web
|
|||
app.UseStatusCodePages();
|
||||
app.UseFileServer();
|
||||
|
||||
app.UseRequestLocalization();
|
||||
app.UseRequestLocalization(new RequestCulture("en-US"));
|
||||
|
||||
app.UseSession();
|
||||
app.UseMvc(routes =>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Localization;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace LocalizationWebSite
|
||||
|
|
@ -20,7 +23,20 @@ namespace LocalizationWebSite
|
|||
{
|
||||
app.UseCultureReplacer();
|
||||
|
||||
app.UseRequestLocalization();
|
||||
var options = new RequestLocalizationOptions
|
||||
{
|
||||
SupportedCultures = new List<CultureInfo>
|
||||
{
|
||||
new CultureInfo("fr"),
|
||||
new CultureInfo("en-GB")
|
||||
},
|
||||
SupportedUICultures = new List<CultureInfo>
|
||||
{
|
||||
new CultureInfo("fr"),
|
||||
new CultureInfo("en-GB")
|
||||
}
|
||||
};
|
||||
app.UseRequestLocalization(options, new RequestCulture("en-US"));
|
||||
|
||||
app.UseMvcWithDefaultRoute();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Localization;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNet.Mvc.Razor;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
|
@ -36,8 +38,23 @@ namespace RazorWebSite
|
|||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
app.UseRequestLocalization();
|
||||
|
||||
var options = new RequestLocalizationOptions
|
||||
{
|
||||
SupportedCultures = new List<CultureInfo>
|
||||
{
|
||||
new CultureInfo("fr"),
|
||||
new CultureInfo("en-GB"),
|
||||
new CultureInfo("en-US")
|
||||
},
|
||||
SupportedUICultures = new List<CultureInfo>
|
||||
{
|
||||
new CultureInfo("fr"),
|
||||
new CultureInfo("en-GB"),
|
||||
new CultureInfo("en-US")
|
||||
}
|
||||
};
|
||||
app.UseRequestLocalization(options, new RequestCulture("en-GB", "en-US"));
|
||||
|
||||
app.UseMvcWithDefaultRoute();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue