Closed HosMercury closed 9 months ago
If you have multiple languages, you can use the code
(https://github.com/Keats/validator#message-and-code) attribute to fetch the error message in the appropriate language.
how code related to the language ?
Think of the code as the key to your i18n translation map, eg regex
. Then you can use fluent of gettext to grab the relevant string for the current language code
sorry for bothering you
but is not code
the name of the attribute( sent from HTML) which is always the same ?
No, code
has nothing to do with HTML. It's something you can set for every validator in the derive (but built-in validator have a default code) like in the link in my first derive.
how to deal with situations when i need the err msg to change depending on language?