I'm using the aspnetboilerplate framework and would like to translate the data model annotations.
I added the code for translation in: Project.Web.Mvc/Startup/Startup.cs
services.AddLocalization(
 options => options.ResourcesPath = "Resources"
 );
    
services
 .AddMvc()
 .AddViewLocalization()
 .AddDataAnnotationsLocalization(options =>
 {
  options.DataAnnotationLocalizerProvider = (type, factory) =>
      factory.Create(typeof(DataAnnotationsLang));
 });
I added the DataAnnotationsLang resource in the directory: Project.Web.Mvc/Resources/DataAnnotationsLang.cs
In the Project.Web.Mvc/Resources/DataAnnotationsLang.pt-PT.resx file I added the translation
The file has the following structure:
<data name="The {0} field is required." xml:space="preserve">
    <value>Translation of field {0}.</value>
    <comment>DataAnnotations RequiredAttribute_ValidationError</comment>
</data>
This is not working. I made according to the microsoft website (https://learn.microsoft.com/en-us/aspnet/core/fundamentals/localization?view=aspnetcore-5.0).