Reacting to new middleware options pattern
This commit is contained in:
parent
2eb6cd655b
commit
c8a59d7f3e
|
|
@ -1,6 +1,7 @@
|
|||
// 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 InlineConstraintSample.Web.Constraints;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Hosting;
|
||||
|
|
@ -25,11 +26,11 @@ namespace InlineConstraintSample.Web
|
|||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
app.UseRequestLocalization(localizationOptions =>
|
||||
app.UseRequestLocalization(new RequestLocalizationOptions
|
||||
{
|
||||
// Ignore ambient and client locale. Use same values as ReplaceCultureAttribute / CultureReplacerMiddleware.
|
||||
localizationOptions.DefaultRequestCulture = new RequestCulture("en-GB", "en-US");
|
||||
localizationOptions.RequestCultureProviders.Clear();
|
||||
DefaultRequestCulture = new RequestCulture("en-GB", "en-US"),
|
||||
RequestCultureProviders = new List<IRequestCultureProvider>()
|
||||
});
|
||||
|
||||
app.UseMvc();
|
||||
|
|
|
|||
|
|
@ -22,19 +22,19 @@ namespace LocalizationSample.Web
|
|||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
app.UseRequestLocalization(options =>
|
||||
app.UseRequestLocalization(new RequestLocalizationOptions
|
||||
{
|
||||
options.DefaultRequestCulture = new RequestCulture("en-US");
|
||||
options.SupportedCultures = new List<CultureInfo>
|
||||
DefaultRequestCulture = new RequestCulture("en-US"),
|
||||
SupportedCultures = new List<CultureInfo>
|
||||
{
|
||||
new CultureInfo("fr"),
|
||||
new CultureInfo("en-GB"),
|
||||
};
|
||||
options.SupportedUICultures = new List<CultureInfo>
|
||||
},
|
||||
SupportedUICultures = new List<CultureInfo>
|
||||
{
|
||||
new CultureInfo("fr"),
|
||||
new CultureInfo("en-GB"),
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
app.UseMvcWithDefaultRoute();
|
||||
|
|
|
|||
|
|
@ -301,6 +301,7 @@ namespace Microsoft.AspNet.Mvc.Filters
|
|||
var serviceCollection = new ServiceCollection();
|
||||
if (registerServices != null)
|
||||
{
|
||||
serviceCollection.AddOptions();
|
||||
serviceCollection.AddLogging();
|
||||
registerServices(serviceCollection);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,21 +43,21 @@ namespace RazorWebSite
|
|||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
app.UseRequestLocalization(options =>
|
||||
app.UseRequestLocalization(new RequestLocalizationOptions
|
||||
{
|
||||
options.DefaultRequestCulture = new RequestCulture("en-GB", "en-US");
|
||||
options.SupportedCultures = new List<CultureInfo>
|
||||
DefaultRequestCulture = new RequestCulture("en-GB", "en-US"),
|
||||
SupportedCultures = new List<CultureInfo>
|
||||
{
|
||||
new CultureInfo("fr"),
|
||||
new CultureInfo("en-GB"),
|
||||
new CultureInfo("en-US"),
|
||||
};
|
||||
options.SupportedUICultures = new List<CultureInfo>
|
||||
},
|
||||
SupportedUICultures = new List<CultureInfo>
|
||||
{
|
||||
new CultureInfo("fr"),
|
||||
new CultureInfo("en-GB"),
|
||||
new CultureInfo("en-US"),
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
app.UseMvcWithDefaultRoute();
|
||||
|
|
|
|||
Loading…
Reference in New Issue