Custom error strings

Some of the error messages that show up on form validation read a bit awkwardly in my opinion (such as "is required"), so I would like to provide my own. Is there any way to do this other than intercepting them in the CoreComponents.translate_error/1 function in the Phoenix 1.7 project template?
Solution:
You can use the transform_errors option: https://hexdocs.pm/ash_phoenix/AshPhoenix.Form.html...
Jump to solution
7 Replies
kernel
kernel•3mo ago
generate .pot files and provide an alternate translation there?
aidalgol
aidalgolOP•3mo ago
That seems the only way to do it.
Solution
ZachDaniel
ZachDaniel•3mo ago
You can use the transform_errors option: https://hexdocs.pm/ash_phoenix/AshPhoenix.Form.html
ZachDaniel
ZachDaniel•3mo ago
Search for it on that page
aidalgol
aidalgolOP•3mo ago
I can't quite make sense of the example given there. Are you able to point me at some concrete examples of using transform_errors? Once I figure it out for my own app, I'll try fleshing out the AshPhoenix doc in a PR. Actually, never mind, I think I've got it. The broken formatting of the code snippet was confusing me. Is it possible to do this with AshAuthenticationPhoenix UI overrides?
ZachDaniel
ZachDaniel•3mo ago
I don't think it can right now but a PR for adding an override for it would be welcome
aidalgol
aidalgolOP•3mo ago
I might have a crack at it. I'm partly glad I wasn't missing something obvious. 😅

Did you find this page helpful?