Provide default localization and globalization for data-annotation generated by tag helpers and model annotations #59916
Labels
area-mvc
Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
HTML form input field tag helpers are rendered useless for many developers by the lack of default localization and globalization for the data-annotations they generate.
Using them in an non-English application causes the display of English validation messages to the user, which is a no-go.
Moreover, culture sensitive inputs do not work.
Have a decimal number input field and an application in French. The number will be output in the input field with a comma as decimal separator (default for french culture). But submitting the form will be blocked by the field considered filled with a value which is "not a number", because the data annotation validation expect a dot for the decimal separator. Complying with this still does not work, because the model binder on server side then rejects the value because it expects a comma as decimal separator.
This causes us to avoid using input field tag helpers entirely.
Describe the solution you'd like
Have default globalization and localization available for data-annotation.
Some workarounds:
Additional context
This is a regression compared to the situation with MVC in .Net Framework, in which data-annotations generated by default HTML helpers (InputFor and the like) were having packages per languages providing default localization and globalization, like this one. (Or was it this or this? Anyway, it was available.)
Related issues:
The text was updated successfully, but these errors were encountered: