asp.net-core-localization

How to Localize validation message (DataAnnotationsValidator) in blazor server side

北战南征 提交于 2021-02-06 10:13:10
问题 I am using blazor 3.1 in latest version of VS 2019. So far, I am able to localize page labels (title, table fields etc.). On the ListEmployee.razor page, I am able to localize table heading etc. On the AddEmplyeeValidation.razor page, I am able to localize form labels but I have a problem localizing the validation messages. For validation message for the Employee.cs file, validation message are defined in the Resources/Data folder in files Data.Employee.resx and Data.Employee.ar.resx but this

How to Localize validation message (DataAnnotationsValidator) in blazor server side

依然范特西╮ 提交于 2021-02-06 10:12:21
问题 I am using blazor 3.1 in latest version of VS 2019. So far, I am able to localize page labels (title, table fields etc.). On the ListEmployee.razor page, I am able to localize table heading etc. On the AddEmplyeeValidation.razor page, I am able to localize form labels but I have a problem localizing the validation messages. For validation message for the Employee.cs file, validation message are defined in the Resources/Data folder in files Data.Employee.resx and Data.Employee.ar.resx but this

ASP.Net Core: set default culture from controller

不想你离开。 提交于 2020-06-16 17:16:09
问题 I am trying to set up localization in my ASP.Net Core Web API project. I did some research and understand that there is a localization middleware with predefined request culture providers (which in my case are not acceptable), so I need to write a custom request culture provider, something like public class CustomCultureProvider : RequestCultureProvider { public override async Task<ProviderCultureResult> ChangeCulture(HttpContext httpContext) { // Return a culture... return new

ASP.Net Core: set default culture from controller

廉价感情. 提交于 2020-06-16 17:16:05
问题 I am trying to set up localization in my ASP.Net Core Web API project. I did some research and understand that there is a localization middleware with predefined request culture providers (which in my case are not acceptable), so I need to write a custom request culture provider, something like public class CustomCultureProvider : RequestCultureProvider { public override async Task<ProviderCultureResult> ChangeCulture(HttpContext httpContext) { // Return a culture... return new

.Net Core Localization View: IViewLocalizer inside Linq expression

我的梦境 提交于 2020-01-03 15:34:18
问题 i'm writing mvc app in .net core, i have problem with localization, i don't know how to add IViewLocalizer to my grid view. Here is my code: @using NonFactors.Mvc.Grid; @using Microsoft.AspNetCore.Mvc.Localization @inject IViewLocalizer Localizer @model IEnumerable<WeegreeEmployeeFormsCore.Models.Employee> @(Html .Grid(Model) .Build(columns => { columns.Add(model => model.Name).Titled(Localizer["Name"]).Sortable(true).Filterable(true); columns.Add(model => model.Surname).Titled(Localizer[

How to get resource strings in strongly typed way in asp.net core?

大憨熊 提交于 2020-01-03 08:48:11
问题 In the following program, in order to get resource strings i am using _localizer["About Title"] where "About Title" is a magic string. How to avoid using strings like this? Is there any strongly typed way? using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Localization; namespace Localization.StarterWeb.Controllers { [Route("api/[controller]")] public class AboutController : Controller { private readonly IStringLocalizer<AboutController> _localizer; public AboutController

ASP.Net Core localization

坚强是说给别人听的谎言 提交于 2019-12-29 06:49:11
问题 ASP.Net core features new support for localization. In my project I need only one language. For most of the text and annotations I can specify things in my language, but for text coming from ASP.Net Core itself the language is English. Examples: Passwords must have at least one uppercase ('A'-'Z'). Passwords must have at least one digit ('0'-'9'). User name 'x@x.com' is already taken. The E-post field is not a valid e-mail address. The value '' is invalid. I've tried setting the culture