Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) Date Validation Error Messages #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kyle-neal
Copy link

  • 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

Fixes the error message when date is invalid
Also fixes binding variables to error string
@kyle-neal
Copy link
Author

Happy new year 🍾

@achedeuzot
Copy link
Owner

achedeuzot commented Mar 20, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants