/// <summary> /// Adds MVC data annotations localization to the application. /// </summary> /// <param name="builder">The <see cref="IMvcBuilder"/>.</param> /// <param name="setupAction">The action to configure <see cref="MvcDataAnnotationsLocalizationOptions"/>. /// </param> /// <returns>The <see cref="IMvcBuilder"/>.</returns> public static IMvcBuilder AddDataAnnotationsLocalization( this IMvcBuilder builder, Action <MvcDataAnnotationsLocalizationOptions>?setupAction) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } DataAnnotationsLocalizationServices.AddDataAnnotationsLocalizationServices( builder.Services, setupAction); return(builder); }
// Internal for testing. internal static void AddDataAnnotationsLocalizationServices( IServiceCollection services, Action <MvcDataAnnotationsLocalizationOptions> setupAction) { DataAnnotationsLocalizationServices.AddDataAnnotationsLocalizationServices(services, setupAction); }