Rest Api Core Culture and disable auto valid
services.Configure<ApiBehaviorOptions>(options => { options.SuppressModelStateInvalidFilter = true; }); services.AddLocalization(options => options.ResourcesPath = "Resources"); // Configure supported cultures and localization options services.Configure<RequestLocalizationOptions>(options => { var supportedCultures = new[] { new CultureInfo("en"), new CultureInfo("pl"), new CultureInfo("de") }; options.DefaultRequestCulture = new RequestCulture(culture: "en", uiCulture: "en"); // You must explicitly state which cultures your application supports. // These are the cultures the app supports for formatting numbers, dates, etc. options.SupportedCultures = supportedCultures; // These are the cultures the app supports for UI strings, i.e. we have localized resources for. options.SupportedUICultures = supportedCultures; //options.RequestCultureProviders.Insert(0, new QueryStringRequestCultureProvider()); }); services.AddMvc().AddViewLocalization().AddDataAnnotationsLocalization();
Kategoria:
- Zaloguj się aby dodać komentarz.