Use named parameters in error messages
When form validation fails user sees an error message next to field that caused validation failure in first place. Mostly such error message have generic texts, like "Field is required", but some error messages are parametrized, like "Incorrect data format, please use int" ("int" part comes from parameter).
Currently error messages use index-based parameters. To use a parameter you need to place "%s
" in error message phrase translation (e.g. "Incorrect data format, please use %s"). This quickly becomes a problem when:
- there are several parameters in single error message and since both represented by "%s" it's not obvious which one will be replaced with what
- in a particular language only 2nd parameter needs be used and 1st parameter ignored
We can solve this using named parameters like {min}, {max}, etc. instead of "%s".
Also to make error messages human friendly a new parameter {field}, that has field name in it, can be introduced to all error messages. This would allow to transform "Field is required" into "First Name is required".