I\'m struggling with localization in my new .NET Core project. I have 2 projects:
unfortunately, it is not that simple to localize all error messages for data attributes in one single place! because there are different types of error messages,
Error messages for standard data attributes:
[Required]
[Range]
[StringLength]
[Compare]
...etc.
Error messages for ModelBinding:
ValueIsInvalid
ValueMustNotBeNull
PropertyValueMustBeANumber
...etc.
and Identity error messages:
DuplicateEmail
DuplicateRoleName
InvalidUserName
PasswordRequiresLower
PasswordRequiresUpper
...etc
each must be configured in the startup file. Additionaly client side validation must be considered as well.
you may check these articles for more details, it contains live demo and sample project on GitHub:
Developing multicultural web application: http://www.ziyad.info/en/articles/10-Developing_Multicultural_Web_Application
Localizing data annotations: http://www.ziyad.info/en/articles/16-Localizing_DataAnnotations
Localizing ModelBinding error messages: http://www.ziyad.info/en/articles/18-Localizing_ModelBinding_Error_Messages
Localizing identity error messages: http://www.ziyad.info/en/articles/20-Localizing_Identity_Error_Messages
and client side validation: http://ziyad.info/en/articles/19-Configuring_Client_Side_Validation
hope it helps :)