In my app, I have custom ModelErrors set, with a fixed message in my case in spanish, for example:
if (tripOdometer <= 0)
{
ModelState.AddModelError("Odometer", $"Inserte una distancia superior a la última almacenada, que fue de {lastFuelingEntryOdometer}");
return View(request);
}
But my problem is that the errors that come with DataAnnotations package are in english (logically), and produce in my case a spanglish output.
A property in one of my models:
[Required]
[Range(1970, 2021)]
[Display(Name = "A?o de Fabricación")]
public int Year { get; set; }
OUTPUTS:
The A?o de Fabricación field is required.
The field A?o de Fabricación must be between 1970 and 2021.
Is it possible to translate them, in a general way for all the models and properties?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…