You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cannot contain "{" and "}" in the message when using method func (t *translator) Add(key interface{}, text string, override bool) error
I want to custom a password validitor with tag valid-password, which requires password can contains a-zA-Z0-9 and (~!@#$%^&*()[]{}|/?,.<>) only, and I'm using the universal-translator to custom the error message when validate fails. The point is when the customed error message contains "{" and "}",there will be an error!
The text was updated successfully, but these errors were encountered:
I think the code upon caused the problem, is there any workaround? I tried \{\} but get error because \{ and \} are not valid escape characters.
pwli0755
changed the title
Cannot contain "{" and "}" in the message when using func (t *translator) Add(key interface{}, text string, override bool) error
Cannot contain "{" and "}" in the parameter text when using func (t *translator) Add(key interface{}, text string, override bool) error
Oct 20, 2020
I am having this problem as well. Additionally, if you have just one of the {} brackets it also fails.
I'm working around it by making the translation something like "{0} must not contain the characters [InvalidPasswordCharacters]" and then doing a find/replace after the translation is done to get "{0} must not contain the characters {}"
Cannot contain "{" and "}" in the message when using method
func (t *translator) Add(key interface{}, text string, override bool) error
I want to custom a password validitor with tag
valid-password
, which requires password can containsa-zA-Z0-9
and(~!@#$%^&*()[]{}|/?,.<>)
only, and I'm using the universal-translator to custom the error message when validate fails. The point is when the customed error message contains "{" and "}",there will be an error!The text was updated successfully, but these errors were encountered: