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

en translation issue: "must contain at maximum X items" #1249

Open
2 tasks done
mila-rodriguez-netapp opened this issue Apr 6, 2024 · 1 comment
Open
2 tasks done

Comments

@mila-rodriguez-netapp
Copy link

  • I have looked at the documentation here first?
  • I have looked at the examples provided that may showcase my question here?

Package version eg. v9, v10:

v10

github.com/go-playground/universal-translator v0.18.1
github.com/go-playground/validator/v10 v10.19.0

Issue, Question or Enhancement:

The default en translations for max have a strange construct (possibly a typo) for slices.

Expected:

{0} must contain maximum {1} items

Actual:

{0} must contain at maximum {1} items

Possibly this is attempting {0} must contain a maximum {1} items or {0} must contain at most {1} items. Not sure what the intent is, but the actual isn't right..

Code sample, to showcase or reproduce:

type Example struct {
    URIs []string `json:"uris" validate:"required,max=5,dive,uri"
}

Hook up the default en translations and you'll get URIs must contain at maximum 5 items

@mila-rodriguez-netapp
Copy link
Author

mila-rodriguez-netapp commented Apr 6, 2024

Since the equivalent with min resolves to {0} must contain at least {1} items, I'm pretty sure the intent here was to have {0} must contain at most {1} items as its max counterpart.

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

No branches or pull requests

1 participant