Reacting to middleware configureOptions updates
This commit is contained in:
parent
399e516065
commit
b7d95d813d
|
|
@ -25,13 +25,12 @@ namespace InlineConstraintSample.Web
|
|||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
// Ignore ambient and client locale. Use same values as ReplaceCultureAttribute / CultureReplacerMiddleware.
|
||||
var localizationOptions = new RequestLocalizationOptions
|
||||
app.UseRequestLocalization(localizationOptions =>
|
||||
{
|
||||
DefaultRequestCulture = new RequestCulture("en-GB", "en-US"),
|
||||
};
|
||||
localizationOptions.RequestCultureProviders.Clear();
|
||||
app.UseRequestLocalization(localizationOptions);
|
||||
// Ignore ambient and client locale. Use same values as ReplaceCultureAttribute / CultureReplacerMiddleware.
|
||||
localizationOptions.DefaultRequestCulture = new RequestCulture("en-GB", "en-US");
|
||||
localizationOptions.RequestCultureProviders.Clear();
|
||||
});
|
||||
|
||||
app.UseMvc();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,21 +22,20 @@ namespace LocalizationSample.Web
|
|||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
var options = new RequestLocalizationOptions
|
||||
app.UseRequestLocalization(options =>
|
||||
{
|
||||
DefaultRequestCulture = new RequestCulture("en-US"),
|
||||
SupportedCultures = new List<CultureInfo>
|
||||
options.DefaultRequestCulture = new RequestCulture("en-US");
|
||||
options.SupportedCultures = new List<CultureInfo>
|
||||
{
|
||||
new CultureInfo("fr"),
|
||||
new CultureInfo("en-GB"),
|
||||
},
|
||||
SupportedUICultures = new List<CultureInfo>
|
||||
};
|
||||
options.SupportedUICultures = new List<CultureInfo>
|
||||
{
|
||||
new CultureInfo("fr"),
|
||||
new CultureInfo("en-GB"),
|
||||
},
|
||||
};
|
||||
app.UseRequestLocalization(options);
|
||||
};
|
||||
});
|
||||
|
||||
app.UseMvcWithDefaultRoute();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,23 +43,22 @@ namespace RazorWebSite
|
|||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
var options = new RequestLocalizationOptions
|
||||
app.UseRequestLocalization(options =>
|
||||
{
|
||||
DefaultRequestCulture = new RequestCulture("en-GB", "en-US"),
|
||||
SupportedCultures = new List<CultureInfo>
|
||||
options.DefaultRequestCulture = new RequestCulture("en-GB", "en-US");
|
||||
options.SupportedCultures = new List<CultureInfo>
|
||||
{
|
||||
new CultureInfo("fr"),
|
||||
new CultureInfo("en-GB"),
|
||||
new CultureInfo("en-US"),
|
||||
},
|
||||
SupportedUICultures = new List<CultureInfo>
|
||||
};
|
||||
options.SupportedUICultures = new List<CultureInfo>
|
||||
{
|
||||
new CultureInfo("fr"),
|
||||
new CultureInfo("en-GB"),
|
||||
new CultureInfo("en-US"),
|
||||
},
|
||||
};
|
||||
app.UseRequestLocalization(options);
|
||||
};
|
||||
});
|
||||
|
||||
app.UseMvcWithDefaultRoute();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue