I'm working on a mvc5 app and I need my validation messsages to be in spanish and i'm using data annotations to achieve this, the problem is that only work for the Required annotation, here is the code i'm using for that.
Model
[Required(ErrorMessage = "El numero de empleado no ha sido ingresado")]
[Display(Name = "Total de empleados de la empresa")]
[RegularExpression("^[0-9]+$", ErrorMessage = "Debe ser un número.")]
public int NumeroEmpleados { get; set; }
View
@Html.EditorFor(model => model.NumeroEmpleados, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.NumeroEmpleados, "", new { @class = "text-danger" })
the problem is that is showing the default message, which is in english, like this.
"The field NumeroEmpleados must be a number. "
EDIT
So, I solved it using jquery.validation localization features, now my number fields are correct, but my currency fields are not, currently they are something like this.
[Required]
[Display(Name = "Recaudo CE")]
[RegularExpression("^[0-9]+$", ErrorMessage = "Ingrese un valor apropiado")]
[DataType(DataType.Currency)]
[DisplayFormat(DataFormatString = "{0:C0}")]
public decimal RecaudoCE { get; set; }