RequestLocalizationOptions Class

Specifies options for the Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.

Namespace
Microsoft.AspNetCore.Builder
Assemblies
  • Microsoft.AspNetCore.Localization

Syntax

public class RequestLocalizationOptions
class Microsoft.AspNetCore.Builder.RequestLocalizationOptions

Constructors

RequestLocalizationOptions()

Creates a new Microsoft.AspNetCore.Builder.RequestLocalizationOptions with default values.

public RequestLocalizationOptions()

Properties

Microsoft.AspNetCore.Builder.RequestLocalizationOptions.DefaultRequestCulture

Gets or sets the default culture to use for requests when a supported culture could not be determined by one of the configured Microsoft.AspNetCore.Localization.IRequestCultureProviders. Defaults to System.Globalization.CultureInfo.CurrentCulture and System.Globalization.CultureInfo.CurrentUICulture.

Return type:Microsoft.AspNetCore.Localization.RequestCulture
public RequestCulture DefaultRequestCulture { get; set; }
Microsoft.AspNetCore.Builder.RequestLocalizationOptions.FallBackToParentCultures

Gets or sets a value indicating whether to set a request culture to an parent culture in the case the culture determined by the configured Microsoft.AspNetCore.Localization.IRequestCultureProviders is not in the Microsoft.AspNetCore.Builder.RequestLocalizationOptions.SupportedCultures list but a parent culture is. Defaults to <code>true</code>;

Return type:System.Boolean
public bool FallBackToParentCultures { get; set; }
Microsoft.AspNetCore.Builder.RequestLocalizationOptions.FallBackToParentUICultures

Gets or sets a value indicating whether to set a request UI culture to a parent culture in the case the UI culture determined by the configured Microsoft.AspNetCore.Localization.IRequestCultureProviders is not in the Microsoft.AspNetCore.Builder.RequestLocalizationOptions.SupportedUICultures list but a parent culture is. Defaults to <code>true</code>;

Return type:System.Boolean
public bool FallBackToParentUICultures { get; set; }
Microsoft.AspNetCore.Builder.RequestLocalizationOptions.RequestCultureProviders

An ordered list of providers used to determine a request’s culture information. The first provider that returns a non-<code>null</code> result for a given request will be used. Defaults to the following: <ol><li> Microsoft.AspNetCore.Localization.QueryStringRequestCultureProvider</li><li> Microsoft.AspNetCore.Localization.CookieRequestCultureProvider</li><li> Microsoft.AspNetCore.Localization.AcceptLanguageHeaderRequestCultureProvider</li></ol>

Return type:System.Collections.Generic.IList<Microsoft.AspNetCore.Localization.IRequestCultureProvider>
public IList<IRequestCultureProvider> RequestCultureProviders { get; set; }
Microsoft.AspNetCore.Builder.RequestLocalizationOptions.SupportedCultures

The cultures supported by the application. The Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware will only set the current request culture to an entry in this list. Defaults to System.Globalization.CultureInfo.CurrentCulture.

Return type:System.Collections.Generic.IList<System.Globalization.CultureInfo>
public IList<CultureInfo> SupportedCultures { get; set; }
Microsoft.AspNetCore.Builder.RequestLocalizationOptions.SupportedUICultures

The UI cultures supported by the application. The Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware will only set the current request culture to an entry in this list. Defaults to System.Globalization.CultureInfo.CurrentUICulture.

Return type:System.Collections.Generic.IList<System.Globalization.CultureInfo>
public IList<CultureInfo> SupportedUICultures { get; set; }