How to translate `can't be blank` error when creating new entities with missing required fields?

Where to put translations for various locales?

Maybe in validate clause options…

https://hexdocs.pm/ecto/Ecto.Changeset.html#validate_required/3

From the docs…

:message - the message on failure, defaults to “can’t be blank”

Are you using gettext?

1 Like

Yes. Now I have managed to get it working. Thank you.

To make this super easy for people new to this I’ll clarify:
import X.Gettext and then use
|> validate_required([:foo, :fighters], message: gettext("can’t be blank"))

1 Like