MvcLocalizationMvcBuilderExtensions.AddMvcLocalization Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
AddMvcLocalization(IMvcBuilder)
Adds MVC view and data annotations localization services to the application.
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddMvcLocalization (this Microsoft.Extensions.DependencyInjection.IMvcBuilder builder);
static member AddMvcLocalization : Microsoft.Extensions.DependencyInjection.IMvcBuilder -> Microsoft.Extensions.DependencyInjection.IMvcBuilder
<Extension()>
Public Function AddMvcLocalization (builder As IMvcBuilder) As IMvcBuilder
Parameters
- builder
- IMvcBuilder
The IMvcBuilder.
Returns
The IMvcBuilder.
Remarks
Adding localization also adds support for views via AddViews(IMvcCoreBuilder) and the Razor view engine via AddRazorViewEngine(IMvcCoreBuilder).
Applies to
AddMvcLocalization(IMvcBuilder, LanguageViewLocationExpanderFormat)
Adds MVC view and data annotations localization services to the application.
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddMvcLocalization (this Microsoft.Extensions.DependencyInjection.IMvcBuilder builder, Microsoft.AspNetCore.Mvc.Razor.LanguageViewLocationExpanderFormat format);
static member AddMvcLocalization : Microsoft.Extensions.DependencyInjection.IMvcBuilder * Microsoft.AspNetCore.Mvc.Razor.LanguageViewLocationExpanderFormat -> Microsoft.Extensions.DependencyInjection.IMvcBuilder
<Extension()>
Public Function AddMvcLocalization (builder As IMvcBuilder, format As LanguageViewLocationExpanderFormat) As IMvcBuilder
Parameters
- builder
- IMvcBuilder
The IMvcBuilder.
The view format for localized views.
Returns
The IMvcBuilder.
Remarks
Adding localization also adds support for views via AddViews(IMvcCoreBuilder) and the Razor view engine via AddRazorViewEngine(IMvcCoreBuilder).
Applies to
AddMvcLocalization(IMvcBuilder, Action<MvcDataAnnotationsLocalizationOptions>)
Adds MVC view and data annotations localization services to the application.
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddMvcLocalization (this Microsoft.Extensions.DependencyInjection.IMvcBuilder builder, Action<Microsoft.AspNetCore.Mvc.DataAnnotations.MvcDataAnnotationsLocalizationOptions> dataAnnotationsLocalizationOptionsSetupAction);
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddMvcLocalization (this Microsoft.Extensions.DependencyInjection.IMvcBuilder builder, Action<Microsoft.AspNetCore.Mvc.DataAnnotations.MvcDataAnnotationsLocalizationOptions>? dataAnnotationsLocalizationOptionsSetupAction);
static member AddMvcLocalization : Microsoft.Extensions.DependencyInjection.IMvcBuilder * Action<Microsoft.AspNetCore.Mvc.DataAnnotations.MvcDataAnnotationsLocalizationOptions> -> Microsoft.Extensions.DependencyInjection.IMvcBuilder
<Extension()>
Public Function AddMvcLocalization (builder As IMvcBuilder, dataAnnotationsLocalizationOptionsSetupAction As Action(Of MvcDataAnnotationsLocalizationOptions)) As IMvcBuilder
Parameters
- builder
- IMvcBuilder
The IMvcBuilder.
- dataAnnotationsLocalizationOptionsSetupAction
- Action<MvcDataAnnotationsLocalizationOptions>
An action to configure the MvcDataAnnotationsLocalizationOptions.
Returns
The IMvcBuilder.
Remarks
Adding localization also adds support for views via AddViews(IMvcCoreBuilder) and the Razor view engine via AddRazorViewEngine(IMvcCoreBuilder).
Applies to
AddMvcLocalization(IMvcBuilder, Action<LocalizationOptions>)
Adds MVC view and data annotations localization services to the application.
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddMvcLocalization (this Microsoft.Extensions.DependencyInjection.IMvcBuilder builder, Action<Microsoft.Extensions.Localization.LocalizationOptions> localizationOptionsSetupAction);
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddMvcLocalization (this Microsoft.Extensions.DependencyInjection.IMvcBuilder builder, Action<Microsoft.Extensions.Localization.LocalizationOptions>? localizationOptionsSetupAction);
static member AddMvcLocalization : Microsoft.Extensions.DependencyInjection.IMvcBuilder * Action<Microsoft.Extensions.Localization.LocalizationOptions> -> Microsoft.Extensions.DependencyInjection.IMvcBuilder
<Extension()>
Public Function AddMvcLocalization (builder As IMvcBuilder, localizationOptionsSetupAction As Action(Of LocalizationOptions)) As IMvcBuilder
Parameters
- builder
- IMvcBuilder
The IMvcBuilder.
- localizationOptionsSetupAction
- Action<LocalizationOptions>
An action to configure the LocalizationOptions.
Returns
The IMvcBuilder.
Remarks
Adding localization also adds support for views via AddViews(IMvcCoreBuilder) and the Razor view engine via AddRazorViewEngine(IMvcCoreBuilder).
Applies to
AddMvcLocalization(IMvcBuilder, LanguageViewLocationExpanderFormat, Action<MvcDataAnnotationsLocalizationOptions>)
Adds MVC view and data annotations localization services to the application.
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddMvcLocalization (this Microsoft.Extensions.DependencyInjection.IMvcBuilder builder, Microsoft.AspNetCore.Mvc.Razor.LanguageViewLocationExpanderFormat format, Action<Microsoft.AspNetCore.Mvc.DataAnnotations.MvcDataAnnotationsLocalizationOptions> dataAnnotationsLocalizationOptionsSetupAction);
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddMvcLocalization (this Microsoft.Extensions.DependencyInjection.IMvcBuilder builder, Microsoft.AspNetCore.Mvc.Razor.LanguageViewLocationExpanderFormat format, Action<Microsoft.AspNetCore.Mvc.DataAnnotations.MvcDataAnnotationsLocalizationOptions>? dataAnnotationsLocalizationOptionsSetupAction);
static member AddMvcLocalization : Microsoft.Extensions.DependencyInjection.IMvcBuilder * Microsoft.AspNetCore.Mvc.Razor.LanguageViewLocationExpanderFormat * Action<Microsoft.AspNetCore.Mvc.DataAnnotations.MvcDataAnnotationsLocalizationOptions> -> Microsoft.Extensions.DependencyInjection.IMvcBuilder
<Extension()>
Public Function AddMvcLocalization (builder As IMvcBuilder, format As LanguageViewLocationExpanderFormat, dataAnnotationsLocalizationOptionsSetupAction As Action(Of MvcDataAnnotationsLocalizationOptions)) As IMvcBuilder
Parameters
- builder
- IMvcBuilder
The IMvcBuilder.
The view format for localized views.
- dataAnnotationsLocalizationOptionsSetupAction
- Action<MvcDataAnnotationsLocalizationOptions>
An action to configure the MvcDataAnnotationsLocalizationOptions.
Returns
The IMvcBuilder.
Remarks
Adding localization also adds support for views via AddViews(IMvcCoreBuilder) and the Razor view engine via AddRazorViewEngine(IMvcCoreBuilder).
Applies to
AddMvcLocalization(IMvcBuilder, Action<LocalizationOptions>, LanguageViewLocationExpanderFormat)
Adds MVC view and data annotations localization services to the application.
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddMvcLocalization (this Microsoft.Extensions.DependencyInjection.IMvcBuilder builder, Action<Microsoft.Extensions.Localization.LocalizationOptions> localizationOptionsSetupAction, Microsoft.AspNetCore.Mvc.Razor.LanguageViewLocationExpanderFormat format);
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddMvcLocalization (this Microsoft.Extensions.DependencyInjection.IMvcBuilder builder, Action<Microsoft.Extensions.Localization.LocalizationOptions>? localizationOptionsSetupAction, Microsoft.AspNetCore.Mvc.Razor.LanguageViewLocationExpanderFormat format);
static member AddMvcLocalization : Microsoft.Extensions.DependencyInjection.IMvcBuilder * Action<Microsoft.Extensions.Localization.LocalizationOptions> * Microsoft.AspNetCore.Mvc.Razor.LanguageViewLocationExpanderFormat -> Microsoft.Extensions.DependencyInjection.IMvcBuilder
<Extension()>
Public Function AddMvcLocalization (builder As IMvcBuilder, localizationOptionsSetupAction As Action(Of LocalizationOptions), format As LanguageViewLocationExpanderFormat) As IMvcBuilder
Parameters
- builder
- IMvcBuilder
The IMvcBuilder.
- localizationOptionsSetupAction
- Action<LocalizationOptions>
An action to configure the LocalizationOptions.
The view format for localized views.
Returns
The IMvcBuilder.
Remarks
Adding localization also adds support for views via AddViews(IMvcCoreBuilder) and the Razor view engine via AddRazorViewEngine(IMvcCoreBuilder).
Applies to
AddMvcLocalization(IMvcBuilder, Action<LocalizationOptions>, Action<MvcDataAnnotationsLocalizationOptions>)
Adds MVC view and data annotations localization services to the application.
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddMvcLocalization (this Microsoft.Extensions.DependencyInjection.IMvcBuilder builder, Action<Microsoft.Extensions.Localization.LocalizationOptions> localizationOptionsSetupAction, Action<Microsoft.AspNetCore.Mvc.DataAnnotations.MvcDataAnnotationsLocalizationOptions> dataAnnotationsLocalizationOptionsSetupAction);
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddMvcLocalization (this Microsoft.Extensions.DependencyInjection.IMvcBuilder builder, Action<Microsoft.Extensions.Localization.LocalizationOptions>? localizationOptionsSetupAction, Action<Microsoft.AspNetCore.Mvc.DataAnnotations.MvcDataAnnotationsLocalizationOptions>? dataAnnotationsLocalizationOptionsSetupAction);
static member AddMvcLocalization : Microsoft.Extensions.DependencyInjection.IMvcBuilder * Action<Microsoft.Extensions.Localization.LocalizationOptions> * Action<Microsoft.AspNetCore.Mvc.DataAnnotations.MvcDataAnnotationsLocalizationOptions> -> Microsoft.Extensions.DependencyInjection.IMvcBuilder
<Extension()>
Public Function AddMvcLocalization (builder As IMvcBuilder, localizationOptionsSetupAction As Action(Of LocalizationOptions), dataAnnotationsLocalizationOptionsSetupAction As Action(Of MvcDataAnnotationsLocalizationOptions)) As IMvcBuilder
Parameters
- builder
- IMvcBuilder
The IMvcBuilder.
- localizationOptionsSetupAction
- Action<LocalizationOptions>
An action to configure the LocalizationOptions.
- dataAnnotationsLocalizationOptionsSetupAction
- Action<MvcDataAnnotationsLocalizationOptions>
An action to configure the MvcDataAnnotationsLocalizationOptions.
Returns
The IMvcBuilder.
Remarks
Adding localization also adds support for views via AddViews(IMvcCoreBuilder) and the Razor view engine via AddRazorViewEngine(IMvcCoreBuilder).
Applies to
AddMvcLocalization(IMvcBuilder, Action<LocalizationOptions>, LanguageViewLocationExpanderFormat, Action<MvcDataAnnotationsLocalizationOptions>)
Adds MVC view and data annotations localization services to the application.
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddMvcLocalization (this Microsoft.Extensions.DependencyInjection.IMvcBuilder builder, Action<Microsoft.Extensions.Localization.LocalizationOptions> localizationOptionsSetupAction, Microsoft.AspNetCore.Mvc.Razor.LanguageViewLocationExpanderFormat format, Action<Microsoft.AspNetCore.Mvc.DataAnnotations.MvcDataAnnotationsLocalizationOptions> dataAnnotationsLocalizationOptionsSetupAction);
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddMvcLocalization (this Microsoft.Extensions.DependencyInjection.IMvcBuilder builder, Action<Microsoft.Extensions.Localization.LocalizationOptions>? localizationOptionsSetupAction, Microsoft.AspNetCore.Mvc.Razor.LanguageViewLocationExpanderFormat format, Action<Microsoft.AspNetCore.Mvc.DataAnnotations.MvcDataAnnotationsLocalizationOptions>? dataAnnotationsLocalizationOptionsSetupAction);
static member AddMvcLocalization : Microsoft.Extensions.DependencyInjection.IMvcBuilder * Action<Microsoft.Extensions.Localization.LocalizationOptions> * Microsoft.AspNetCore.Mvc.Razor.LanguageViewLocationExpanderFormat * Action<Microsoft.AspNetCore.Mvc.DataAnnotations.MvcDataAnnotationsLocalizationOptions> -> Microsoft.Extensions.DependencyInjection.IMvcBuilder
<Extension()>
Public Function AddMvcLocalization (builder As IMvcBuilder, localizationOptionsSetupAction As Action(Of LocalizationOptions), format As LanguageViewLocationExpanderFormat, dataAnnotationsLocalizationOptionsSetupAction As Action(Of MvcDataAnnotationsLocalizationOptions)) As IMvcBuilder
Parameters
- builder
- IMvcBuilder
The IMvcBuilder.
- localizationOptionsSetupAction
- Action<LocalizationOptions>
An action to configure the LocalizationOptions.
Can be null
.
The view format for localized views.
- dataAnnotationsLocalizationOptionsSetupAction
- Action<MvcDataAnnotationsLocalizationOptions>
An action to configure
the MvcDataAnnotationsLocalizationOptions. Can be null
.
Returns
The IMvcBuilder.
Remarks
Adding localization also adds support for views via AddViews(IMvcCoreBuilder) and the Razor view engine via AddRazorViewEngine(IMvcCoreBuilder).