ecto_commons icon indicating copy to clipboard operation
ecto_commons copied to clipboard

(fix) Date Validation Error Messages

Open kyle-neal opened this issue 2 years ago • 2 comments

  • 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 image

AFTER image

kyle-neal avatar Dec 31 '22 19:12 kyle-neal

Happy new year 🍾

kyle-neal avatar Jan 01 '23 06:01 kyle-neal

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.

achedeuzot avatar Mar 20 '23 10:03 achedeuzot