Skip to content

Commit

Permalink
Add translation of requiredXXX and excludedXXX in English/Chinese/Chi…
Browse files Browse the repository at this point in the history
…nese Taiwan (go-playground#1170)

## Fixes Or Enhances

Add translation of below in English/Chinese/Chinese Taiwan :
    required_unless
    required_with
    required_with_all
    required_without
    required_without_all
    excluded_if
    excluded_unless
    excluded_with
    excluded_with_all
    excluded_without
    excluded_without_all

**Make sure that you've checked the boxes below before you submit PR:**
- [x] Tests exist or have been written that cover this particular
change.

@go-playground/validator-maintainers
  • Loading branch information
violin0622 authored and d1slike committed Apr 1, 2024
1 parent 505de6b commit 9a3ad40
Show file tree
Hide file tree
Showing 6 changed files with 547 additions and 138 deletions.
60 changes: 60 additions & 0 deletions translations/en/en.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,66 @@ func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (er
translation: "{0} is a required field",
override: false,
},
{
tag: "required_unless",
translation: "{0} is a required field",
override: false,
},
{
tag: "required_with",
translation: "{0} is a required field",
override: false,
},
{
tag: "required_with_all",
translation: "{0} is a required field",
override: false,
},
{
tag: "required_without",
translation: "{0} is a required field",
override: false,
},
{
tag: "required_without_all",
translation: "{0} is a required field",
override: false,
},
{
tag: "excluded_if",
translation: "{0} is an excluded field",
override: false,
},
{
tag: "excluded_unless",
translation: "{0} is an excluded field",
override: false,
},
{
tag: "excluded_with",
translation: "{0} is an excluded field",
override: false,
},
{
tag: "excluded_with_all",
translation: "{0} is an excluded field",
override: false,
},
{
tag: "excluded_without",
translation: "{0} is an excluded field",
override: false,
},
{
tag: "excluded_without_all",
translation: "{0} is an excluded field",
override: false,
},
{
tag: "isdefault",
translation: "{0} must be default value",
override: false,
},
{
tag: "len",
customRegisFunc: func(ut ut.Translator) (err error) {
Expand Down
Loading

0 comments on commit 9a3ad40

Please sign in to comment.