ecto_commons
ecto_commons copied to clipboard
(fix) Date Validation Error Messages
- Fixes the error message when date is invalid
- Also fixes binding variables to error string
[error] missing Gettext bindings: [:after] (backend NetAdminWeb.Gettext, locale "en", domain "errors", msgctxt nil, msgid "should be after %{after}.")
BEFORE
AFTER
Happy new year 🍾
Hey @kyle-neal , Thanks for the pull request ❤️ and sorry for the late reply.
I'm using the same format as Ecto validation which uses %{}
for placeholders, e.g. https://github.com/elixir-ecto/ecto/blob/v3.9.4/lib/ecto/changeset.ex#L2234 so that it can work with gettext translation. Using #{}
will make it replace the string in place making translation impossible.
gettext
does complain rightfully as it's detecting missing values for placeholders. This should be fixed with the proper usage of gettext for errors instead of relying on Elixir string interpolation.