New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide target parameter field names as message placeholders #2290
Comments
Sounds good to me, I will try to implement it for the next release. |
Thanks. Current workaround for me is to use the same name like the target field but the desired label on my input. But I think that's not how it is meant to be. |
Any reason the original message doesn't just use English @makana !? By the way, I also need this functionality. |
@logaretm - would you accept a PR for this if you don't have time? I have a post-process function I run to do the same thing, but would be much nicer built-in of course. |
@davestewart If it is not a problem that would be great, I didn't get a chance to implement this yet. |
I'm guessing it's not too complex in the validator src, but you would want tests and docs update for a full PR, right? Anything else? |
That's more than enough, thanks! |
Yep, looking good. |
Something like |
Sorry - I deleted the question, as I realised we can just use the field key, so |
Thanks for implementing this! |
Usage for single and multiple targets here: |
Consider the "confirmed" rule.
The german message "Die Bestätigung von {_field_} stimmt nicht überein" literally means "The confirmation OF {_field_} does not match." which is odd, because it is the confirmation of the target field, not the field itself.
My proposal is to provide additional "internal" message placeholders that contain the name of the target parameter fields.
So as en example for the "confirmed" rule you have the parameter "target" which is the value of the target field.
Just add "{_target_}" to the parameter list and provide the name of the target field here.
Technically its "{_<targetParameterName>_}" because you could have multiple target parameters.
This would lead to a perfect message "Die Bestätigung von {_target_} stimmt nicht überein."/"The confirmation of {_target_} does not match." which is what the confirmed rule really is about to say.
Thanks.
The text was updated successfully, but these errors were encountered: