-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Closed
Copy link
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Milestone
Description
Background and Motivation
Changing the culture date/time format reflect to the default culture, there's no way in the current APIs to allow the user doesn't rely on the system settings
Proposed API
+ private readonly bool _useUserOverride;
+
private RequestCulture _defaultRequestCulture =
new RequestCulture(CultureInfo.CurrentCulture, CultureInfo.CurrentUICulture);
- public RequestLocalizationOptions()
+ public RequestLocalizationOptions() : this(useUserOverride: true)
{
- RequestCultureProviders = new List<IRequestCultureProvider>
- {
- new QueryStringRequestCultureProvider { Options = this },
- new CookieRequestCultureProvider { Options = this },
- new AcceptLanguageHeaderRequestCultureProvider { Options = this }
- };
}
+ public RequestLocalizationOptions(bool useUserOverride)
+{
+ _useUserOverride = useUserOverride;
+ RequestCultureProviders = new List<IRequestCultureProvider>
+ {
+ new QueryStringRequestCultureProvider { Options = this },
+ new CookieRequestCultureProvider { Options = this },
+ new AcceptLanguageHeaderRequestCultureProvider { Options = this }
+ };Usage Examples
var options = new RequestLocalizationOptions(useUserOverride: true);
app.UseRequestLocalization(options);Alternative Designs
Risks
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions