3
votes

I am using .po files for localization in asp.net core 2 - https://docs.microsoft.com/en-us/aspnet/core/fundamentals/portable-object-localization?view=aspnetcore-2.1

I am using it sucessfully inside views or controllers, but how to use it with DataAttributes in viewmodels. Example:

    [Required(ErrorMessage = "RoleName is required")]
    [MinLength(1)]
    public string RoleName { get; set; }

Does anyone has any idea if it's possible?

1

1 Answers

1
votes

I think it is being solved/solved already, reading this issue: https://github.com/OrchardCMS/OrchardCore/issues/1462

"What do we do for the error messages? Do we convert them as [Required(ErrorMessage = "localized error message")] or should we use the default MVC error messages? (enabled via [Required])"

resolved as

"Works in culture-settings branch by adding simply builder.AddDataAnnotationsLocalization(); in OrchardCore.Mvc.Core Startup.cs file."

The PR was merged.