Repository: go-playground/validator
Pull request #1170 (2023-09-18 07:37:28)

Add translation of requiredXXX and excludedXXX in English/Chinese/Chinese Taiwan
## 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

coveralls: 
[![Coverage Status](https://coveralls.io/builds/62713611/badge)](https://coveralls.io/builds/62713611)

coverage: 74.115% (+0.3%) from 73.849% when pulling **4b9a099f977feb1ed12039138c220ba8bd23f8a8 on violin0622:master** into **8d50f2fd8c2f02fbdf1d44d66171b955c2f4eb50 on go-playground:master**.

violin0622: Anyone who review and approve? 

Patch:
diff --git a/errors.go b/errors.go
index 5856d57..be2676e 100644
--- a/errors.go
+++ b/errors.go
@@ -257,15 +257,19 @@ func (fe *fieldError) Error() string {
 // NOTE: if no registered translation can be found, it returns the original
 // untranslated error message.
 func (fe *fieldError) Translate(ut ut.Translator) string {
+	var fn TranslationFunc
 
 	m, ok := fe.v.transTagFunc[ut]
 	if !ok {
 		return fe.Error()
 	}
 
-	fn, ok := m[fe.tag]
+	fn, ok = m[fe.tag]
 	if !ok {
-		return fe.Error()
+		fn, ok = m[fe.actualTag]
+		if !ok {
+			return fe.Error()
+		}
 	}
 
 	return fn(ut, fe)
diff --git a/translations/en/en.go b/translations/en/en.go
index 4c34ded..9cef10e 100644
--- a/translations/en/en.go
+++ b/translations/en/en.go
@@ -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) {
diff --git a/translations/zh/zh.go b/translations/zh/zh.go
index 0b084e5..19221e3 100644
--- a/translations/zh/zh.go
+++ b/translations/zh/zh.go
@@ -59,6 +59,41 @@ func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (er
 			translation: "{0}为必填字段",
 			override:    false,
 		},
+		{
+			tag:         "excluded_if",
+			translation: "{0}为禁填字段",
+			override:    false,
+		},
+		{
+			tag:         "excluded_unless",
+			translation: "{0}为禁填字段",
+			override:    false,
+		},
+		{
+			tag:         "excluded_with",
+			translation: "{0}为禁填字段",
+			override:    false,
+		},
+		{
+			tag:         "excluded_with_all",
+			translation: "{0}为禁填字段",
+			override:    false,
+		},
+		{
+			tag:         "excluded_without",
+			translation: "{0}为禁填字段",
+			override:    false,
+		},
+		{
+			tag:         "excluded_without_all",
+			translation: "{0}为禁填字段",
+			override:    false,
+		},
+		{
+			tag:         "isdefault",
+			translation: "{0}为禁填字段",
+			override:    false,
+		},
 		{
 			tag: "len",
 			customRegisFunc: func(ut ut.Translator) (err error) {
diff --git a/translations/zh_tw/zh_tw.go b/translations/zh_tw/zh_tw.go
index e465eb6..a11bdc8 100644
--- a/translations/zh_tw/zh_tw.go
+++ b/translations/zh_tw/zh_tw.go
@@ -29,6 +29,71 @@ func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (er
 			translation: "{0}為必填欄位",
 			override:    false,
 		},
+		{
+			tag:         "required_if",
+			translation: "{0}為必填欄位",
+			override:    false,
+		},
+		{
+			tag:         "required_unless",
+			translation: "{0}為必填欄位",
+			override:    false,
+		},
+		{
+			tag:         "required_with",
+			translation: "{0}為必填欄位",
+			override:    false,
+		},
+		{
+			tag:         "required_with_all",
+			translation: "{0}為必填欄位",
+			override:    false,
+		},
+		{
+			tag:         "required_without",
+			translation: "{0}為必填欄位",
+			override:    false,
+		},
+		{
+			tag:         "required_without_all",
+			translation: "{0}為必填欄位",
+			override:    false,
+		},
+		{
+			tag:         "excluded_if",
+			translation: "{0}為禁填欄位",
+			override:    false,
+		},
+		{
+			tag:         "excluded_unless",
+			translation: "{0}為禁填欄位",
+			override:    false,
+		},
+		{
+			tag:         "excluded_with",
+			translation: "{0}為禁填欄位",
+			override:    false,
+		},
+		{
+			tag:         "excluded_with_all",
+			translation: "{0}為禁填欄位",
+			override:    false,
+		},
+		{
+			tag:         "excluded_without",
+			translation: "{0}為禁填欄位",
+			override:    false,
+		},
+		{
+			tag:         "excluded_without_all",
+			translation: "{0}為禁填欄位",
+			override:    false,
+		},
+		{
+			tag:         "isdefault",
+			translation: "{0}為禁填欄位",
+			override:    false,
+		},
 		{
 			tag: "len",
 			customRegisFunc: func(ut ut.Translator) (err error) {


Test patch:
diff --git a/translations/en/en_test.go b/translations/en/en_test.go
index 6782f3b..e5d397e 100644
--- a/translations/en/en_test.go
+++ b/translations/en/en_test.go
@@ -21,141 +21,164 @@ func TestTranslations(t *testing.T) {
 	Equal(t, err, nil)
 
 	type Inner struct {
-		EqCSFieldString  string
-		NeCSFieldString  string
-		GtCSFieldString  string
-		GteCSFieldString string
-		LtCSFieldString  string
-		LteCSFieldString string
-		RequiredIf       string
+		EqCSFieldString    string
+		NeCSFieldString    string
+		GtCSFieldString    string
+		GteCSFieldString   string
+		LtCSFieldString    string
+		LteCSFieldString   string
+		RequiredIf         string
+		RequiredUnless     string
+		RequiredWith       string
+		RequiredWithAll    string
+		RequiredWithout    string
+		RequiredWithoutAll string
+		ExcludedIf         string
+		ExcludedUnless     string
+		ExcludedWith       string
+		ExcludedWithAll    string
+		ExcludedWithout    string
+		ExcludedWithoutAll string
 	}
 
 	type Test struct {
-		Inner             Inner
-		RequiredString    string            `validate:"required"`
-		RequiredNumber    int               `validate:"required"`
-		RequiredMultiple  []string          `validate:"required"`
-		RequiredIf        string            `validate:"required_if=Inner.RequiredIf abcd"`
-		LenString         string            `validate:"len=1"`
-		LenNumber         float64           `validate:"len=1113.00"`
-		LenMultiple       []string          `validate:"len=7"`
-		MinString         string            `validate:"min=1"`
-		MinNumber         float64           `validate:"min=1113.00"`
-		MinMultiple       []string          `validate:"min=7"`
-		MaxString         string            `validate:"max=3"`
-		MaxNumber         float64           `validate:"max=1113.00"`
-		MaxMultiple       []string          `validate:"max=7"`
-		EqString          string            `validate:"eq=3"`
-		EqNumber          float64           `validate:"eq=2.33"`
-		EqMultiple        []string          `validate:"eq=7"`
-		NeString          string            `validate:"ne="`
-		NeNumber          float64           `validate:"ne=0.00"`
-		NeMultiple        []string          `validate:"ne=0"`
-		LtString          string            `validate:"lt=3"`
-		LtNumber          float64           `validate:"lt=5.56"`
-		LtMultiple        []string          `validate:"lt=2"`
-		LtTime            time.Time         `validate:"lt"`
-		LteString         string            `validate:"lte=3"`
-		LteNumber         float64           `validate:"lte=5.56"`
-		LteMultiple       []string          `validate:"lte=2"`
-		LteTime           time.Time         `validate:"lte"`
-		GtString          string            `validate:"gt=3"`
-		GtNumber          float64           `validate:"gt=5.56"`
-		GtMultiple        []string          `validate:"gt=2"`
-		GtTime            time.Time         `validate:"gt"`
-		GteString         string            `validate:"gte=3"`
-		GteNumber         float64           `validate:"gte=5.56"`
-		GteMultiple       []string          `validate:"gte=2"`
-		GteTime           time.Time         `validate:"gte"`
-		EqFieldString     string            `validate:"eqfield=MaxString"`
-		EqCSFieldString   string            `validate:"eqcsfield=Inner.EqCSFieldString"`
-		NeCSFieldString   string            `validate:"necsfield=Inner.NeCSFieldString"`
-		GtCSFieldString   string            `validate:"gtcsfield=Inner.GtCSFieldString"`
-		GteCSFieldString  string            `validate:"gtecsfield=Inner.GteCSFieldString"`
-		LtCSFieldString   string            `validate:"ltcsfield=Inner.LtCSFieldString"`
-		LteCSFieldString  string            `validate:"ltecsfield=Inner.LteCSFieldString"`
-		NeFieldString     string            `validate:"nefield=EqFieldString"`
-		GtFieldString     string            `validate:"gtfield=MaxString"`
-		GteFieldString    string            `validate:"gtefield=MaxString"`
-		LtFieldString     string            `validate:"ltfield=MaxString"`
-		LteFieldString    string            `validate:"ltefield=MaxString"`
-		AlphaString       string            `validate:"alpha"`
-		AlphanumString    string            `validate:"alphanum"`
-		NumericString     string            `validate:"numeric"`
-		NumberString      string            `validate:"number"`
-		HexadecimalString string            `validate:"hexadecimal"`
-		HexColorString    string            `validate:"hexcolor"`
-		RGBColorString    string            `validate:"rgb"`
-		RGBAColorString   string            `validate:"rgba"`
-		HSLColorString    string            `validate:"hsl"`
-		HSLAColorString   string            `validate:"hsla"`
-		Email             string            `validate:"email"`
-		URL               string            `validate:"url"`
-		URI               string            `validate:"uri"`
-		Base64            string            `validate:"base64"`
-		Contains          string            `validate:"contains=purpose"`
-		ContainsAny       string            `validate:"containsany=!@#$"`
-		Excludes          string            `validate:"excludes=text"`
-		ExcludesAll       string            `validate:"excludesall=!@#$"`
-		ExcludesRune      string            `validate:"excludesrune=☻"`
-		ISBN              string            `validate:"isbn"`
-		ISBN10            string            `validate:"isbn10"`
-		ISBN13            string            `validate:"isbn13"`
-		ISSN              string            `validate:"issn"`
-		UUID              string            `validate:"uuid"`
-		UUID3             string            `validate:"uuid3"`
-		UUID4             string            `validate:"uuid4"`
-		UUID5             string            `validate:"uuid5"`
-		ULID              string            `validate:"ulid"`
-		ASCII             string            `validate:"ascii"`
-		PrintableASCII    string            `validate:"printascii"`
-		MultiByte         string            `validate:"multibyte"`
-		DataURI           string            `validate:"datauri"`
-		Latitude          string            `validate:"latitude"`
-		Longitude         string            `validate:"longitude"`
-		SSN               string            `validate:"ssn"`
-		IP                string            `validate:"ip"`
-		IPv4              string            `validate:"ipv4"`
-		IPv6              string            `validate:"ipv6"`
-		CIDR              string            `validate:"cidr"`
-		CIDRv4            string            `validate:"cidrv4"`
-		CIDRv6            string            `validate:"cidrv6"`
-		TCPAddr           string            `validate:"tcp_addr"`
-		TCPAddrv4         string            `validate:"tcp4_addr"`
-		TCPAddrv6         string            `validate:"tcp6_addr"`
-		UDPAddr           string            `validate:"udp_addr"`
-		UDPAddrv4         string            `validate:"udp4_addr"`
-		UDPAddrv6         string            `validate:"udp6_addr"`
-		IPAddr            string            `validate:"ip_addr"`
-		IPAddrv4          string            `validate:"ip4_addr"`
-		IPAddrv6          string            `validate:"ip6_addr"`
-		UinxAddr          string            `validate:"unix_addr"` // can't fail from within Go's net package currently, but maybe in the future
-		MAC               string            `validate:"mac"`
-		FQDN              string            `validate:"fqdn"`
-		IsColor           string            `validate:"iscolor"`
-		StrPtrMinLen      *string           `validate:"min=10"`
-		StrPtrMaxLen      *string           `validate:"max=1"`
-		StrPtrLen         *string           `validate:"len=2"`
-		StrPtrLt          *string           `validate:"lt=1"`
-		StrPtrLte         *string           `validate:"lte=1"`
-		StrPtrGt          *string           `validate:"gt=10"`
-		StrPtrGte         *string           `validate:"gte=10"`
-		OneOfString       string            `validate:"oneof=red green"`
-		OneOfInt          int               `validate:"oneof=5 63"`
-		UniqueSlice       []string          `validate:"unique"`
-		UniqueArray       [3]string         `validate:"unique"`
-		UniqueMap         map[string]string `validate:"unique"`
-		JSONString        string            `validate:"json"`
-		JWTString         string            `validate:"jwt"`
-		LowercaseString   string            `validate:"lowercase"`
-		UppercaseString   string            `validate:"uppercase"`
-		Datetime          string            `validate:"datetime=2006-01-02"`
-		PostCode          string            `validate:"postcode_iso3166_alpha2=SG"`
-		PostCodeCountry   string
-		PostCodeByField   string `validate:"postcode_iso3166_alpha2_field=PostCodeCountry"`
-		BooleanString     string `validate:"boolean"`
-		Image             string `validate:"image"`
-		CveString         string `validate:"cve"`
+		Inner              Inner
+		RequiredString     string            `validate:"required"`
+		RequiredNumber     int               `validate:"required"`
+		RequiredMultiple   []string          `validate:"required"`
+		RequiredIf         string            `validate:"required_if=Inner.RequiredIf abcd"`
+		RequiredUnless     string            `validate:"required_unless=Inner.RequiredUnless abcd"`
+		RequiredWith       string            `validate:"required_with=Inner.RequiredWith"`
+		RequiredWithAll    string            `validate:"required_with_all=Inner.RequiredWith Inner.RequiredWithAll"`
+		RequiredWithout    string            `validate:"required_without=Inner.RequiredWithout"`
+		RequiredWithoutAll string            `validate:"required_without_all=Inner.RequiredWithout Inner.RequiredWithoutAll"`
+		ExcludedIf         string            `validate:"excluded_if=Inner.ExcludedIf abcd"`
+		ExcludedUnless     string            `validate:"excluded_unless=Inner.ExcludedUnless abcd"`
+		ExcludedWith       string            `validate:"excluded_with=Inner.ExcludedWith"`
+		ExcludedWithout    string            `validate:"excluded_with_all=Inner.ExcludedWithAll"`
+		ExcludedWithAll    string            `validate:"excluded_without=Inner.ExcludedWithout"`
+		ExcludedWithoutAll string            `validate:"excluded_without_all=Inner.ExcludedWithoutAll"`
+		IsDefault          string            `validate:"isdefault"`
+		LenString          string            `validate:"len=1"`
+		LenNumber          float64           `validate:"len=1113.00"`
+		LenMultiple        []string          `validate:"len=7"`
+		MinString          string            `validate:"min=1"`
+		MinNumber          float64           `validate:"min=1113.00"`
+		MinMultiple        []string          `validate:"min=7"`
+		MaxString          string            `validate:"max=3"`
+		MaxNumber          float64           `validate:"max=1113.00"`
+		MaxMultiple        []string          `validate:"max=7"`
+		EqString           string            `validate:"eq=3"`
+		EqNumber           float64           `validate:"eq=2.33"`
+		EqMultiple         []string          `validate:"eq=7"`
+		NeString           string            `validate:"ne="`
+		NeNumber           float64           `validate:"ne=0.00"`
+		NeMultiple         []string          `validate:"ne=0"`
+		LtString           string            `validate:"lt=3"`
+		LtNumber           float64           `validate:"lt=5.56"`
+		LtMultiple         []string          `validate:"lt=2"`
+		LtTime             time.Time         `validate:"lt"`
+		LteString          string            `validate:"lte=3"`
+		LteNumber          float64           `validate:"lte=5.56"`
+		LteMultiple        []string          `validate:"lte=2"`
+		LteTime            time.Time         `validate:"lte"`
+		GtString           string            `validate:"gt=3"`
+		GtNumber           float64           `validate:"gt=5.56"`
+		GtMultiple         []string          `validate:"gt=2"`
+		GtTime             time.Time         `validate:"gt"`
+		GteString          string            `validate:"gte=3"`
+		GteNumber          float64           `validate:"gte=5.56"`
+		GteMultiple        []string          `validate:"gte=2"`
+		GteTime            time.Time         `validate:"gte"`
+		EqFieldString      string            `validate:"eqfield=MaxString"`
+		EqCSFieldString    string            `validate:"eqcsfield=Inner.EqCSFieldString"`
+		NeCSFieldString    string            `validate:"necsfield=Inner.NeCSFieldString"`
+		GtCSFieldString    string            `validate:"gtcsfield=Inner.GtCSFieldString"`
+		GteCSFieldString   string            `validate:"gtecsfield=Inner.GteCSFieldString"`
+		LtCSFieldString    string            `validate:"ltcsfield=Inner.LtCSFieldString"`
+		LteCSFieldString   string            `validate:"ltecsfield=Inner.LteCSFieldString"`
+		NeFieldString      string            `validate:"nefield=EqFieldString"`
+		GtFieldString      string            `validate:"gtfield=MaxString"`
+		GteFieldString     string            `validate:"gtefield=MaxString"`
+		LtFieldString      string            `validate:"ltfield=MaxString"`
+		LteFieldString     string            `validate:"ltefield=MaxString"`
+		AlphaString        string            `validate:"alpha"`
+		AlphanumString     string            `validate:"alphanum"`
+		NumericString      string            `validate:"numeric"`
+		NumberString       string            `validate:"number"`
+		HexadecimalString  string            `validate:"hexadecimal"`
+		HexColorString     string            `validate:"hexcolor"`
+		RGBColorString     string            `validate:"rgb"`
+		RGBAColorString    string            `validate:"rgba"`
+		HSLColorString     string            `validate:"hsl"`
+		HSLAColorString    string            `validate:"hsla"`
+		Email              string            `validate:"email"`
+		URL                string            `validate:"url"`
+		URI                string            `validate:"uri"`
+		Base64             string            `validate:"base64"`
+		Contains           string            `validate:"contains=purpose"`
+		ContainsAny        string            `validate:"containsany=!@#$"`
+		Excludes           string            `validate:"excludes=text"`
+		ExcludesAll        string            `validate:"excludesall=!@#$"`
+		ExcludesRune       string            `validate:"excludesrune=☻"`
+		ISBN               string            `validate:"isbn"`
+		ISBN10             string            `validate:"isbn10"`
+		ISBN13             string            `validate:"isbn13"`
+		ISSN               string            `validate:"issn"`
+		UUID               string            `validate:"uuid"`
+		UUID3              string            `validate:"uuid3"`
+		UUID4              string            `validate:"uuid4"`
+		UUID5              string            `validate:"uuid5"`
+		ULID               string            `validate:"ulid"`
+		ASCII              string            `validate:"ascii"`
+		PrintableASCII     string            `validate:"printascii"`
+		MultiByte          string            `validate:"multibyte"`
+		DataURI            string            `validate:"datauri"`
+		Latitude           string            `validate:"latitude"`
+		Longitude          string            `validate:"longitude"`
+		SSN                string            `validate:"ssn"`
+		IP                 string            `validate:"ip"`
+		IPv4               string            `validate:"ipv4"`
+		IPv6               string            `validate:"ipv6"`
+		CIDR               string            `validate:"cidr"`
+		CIDRv4             string            `validate:"cidrv4"`
+		CIDRv6             string            `validate:"cidrv6"`
+		TCPAddr            string            `validate:"tcp_addr"`
+		TCPAddrv4          string            `validate:"tcp4_addr"`
+		TCPAddrv6          string            `validate:"tcp6_addr"`
+		UDPAddr            string            `validate:"udp_addr"`
+		UDPAddrv4          string            `validate:"udp4_addr"`
+		UDPAddrv6          string            `validate:"udp6_addr"`
+		IPAddr             string            `validate:"ip_addr"`
+		IPAddrv4           string            `validate:"ip4_addr"`
+		IPAddrv6           string            `validate:"ip6_addr"`
+		UinxAddr           string            `validate:"unix_addr"` // can't fail from within Go's net package currently, but maybe in the future
+		MAC                string            `validate:"mac"`
+		FQDN               string            `validate:"fqdn"`
+		IsColor            string            `validate:"iscolor"`
+		StrPtrMinLen       *string           `validate:"min=10"`
+		StrPtrMaxLen       *string           `validate:"max=1"`
+		StrPtrLen          *string           `validate:"len=2"`
+		StrPtrLt           *string           `validate:"lt=1"`
+		StrPtrLte          *string           `validate:"lte=1"`
+		StrPtrGt           *string           `validate:"gt=10"`
+		StrPtrGte          *string           `validate:"gte=10"`
+		OneOfString        string            `validate:"oneof=red green"`
+		OneOfInt           int               `validate:"oneof=5 63"`
+		UniqueSlice        []string          `validate:"unique"`
+		UniqueArray        [3]string         `validate:"unique"`
+		UniqueMap          map[string]string `validate:"unique"`
+		JSONString         string            `validate:"json"`
+		JWTString          string            `validate:"jwt"`
+		LowercaseString    string            `validate:"lowercase"`
+		UppercaseString    string            `validate:"uppercase"`
+		Datetime           string            `validate:"datetime=2006-01-02"`
+		PostCode           string            `validate:"postcode_iso3166_alpha2=SG"`
+		PostCodeCountry    string
+		PostCodeByField    string `validate:"postcode_iso3166_alpha2_field=PostCodeCountry"`
+		BooleanString      string `validate:"boolean"`
+		Image              string `validate:"image"`
+		CveString          string `validate:"cve"`
 	}
 
 	var test Test
@@ -163,6 +186,20 @@ func TestTranslations(t *testing.T) {
 	test.Inner.EqCSFieldString = "1234"
 	test.Inner.GtCSFieldString = "1234"
 	test.Inner.GteCSFieldString = "1234"
+	test.Inner.RequiredUnless = "1234"
+	test.Inner.RequiredWith = "1234"
+	test.Inner.RequiredWithAll = "1234"
+	test.Inner.ExcludedIf = "abcd"
+	test.Inner.ExcludedUnless = "1234"
+	test.Inner.ExcludedWith = "1234"
+	test.Inner.ExcludedWithAll = "1234"
+
+	test.ExcludedIf = "1234"
+	test.ExcludedUnless = "1234"
+	test.ExcludedWith = "1234"
+	test.ExcludedWithAll = "1234"
+	test.ExcludedWithout = "1234"
+	test.ExcludedWithoutAll = "1234"
 
 	test.MaxString = "1234"
 	test.MaxNumber = 2000
@@ -623,6 +660,50 @@ func TestTranslations(t *testing.T) {
 			ns:       "Test.RequiredMultiple",
 			expected: "RequiredMultiple is a required field",
 		},
+		{
+			ns:       "Test.RequiredUnless",
+			expected: "RequiredUnless is a required field",
+		},
+		{
+			ns:       "Test.RequiredWith",
+			expected: "RequiredWith is a required field",
+		},
+		{
+			ns:       "Test.RequiredWithAll",
+			expected: "RequiredWithAll is a required field",
+		},
+		{
+			ns:       "Test.RequiredWithout",
+			expected: "RequiredWithout is a required field",
+		},
+		{
+			ns:       "Test.RequiredWithoutAll",
+			expected: "RequiredWithoutAll is a required field",
+		},
+		{
+			ns:       "Test.ExcludedIf",
+			expected: "ExcludedIf is an excluded field",
+		},
+		{
+			ns:       "Test.ExcludedUnless",
+			expected: "ExcludedUnless is an excluded field",
+		},
+		{
+			ns:       "Test.ExcludedWith",
+			expected: "ExcludedWith is an excluded field",
+		},
+		{
+			ns:       "Test.ExcludedWithAll",
+			expected: "ExcludedWithAll is an excluded field",
+		},
+		{
+			ns:       "Test.ExcludedWithout",
+			expected: "ExcludedWithout is an excluded field",
+		},
+		{
+			ns:       "Test.ExcludedWithoutAll",
+			expected: "ExcludedWithoutAll is an excluded field",
+		},
 		{
 			ns:       "Test.StrPtrMinLen",
 			expected: "StrPtrMinLen must be at least 10 characters in length",
diff --git a/translations/zh/zh_test.go b/translations/zh/zh_test.go
index 2b8ee05..e8af017 100644
--- a/translations/zh/zh_test.go
+++ b/translations/zh/zh_test.go
@@ -22,12 +22,24 @@ func TestTranslations(t *testing.T) {
 	Equal(t, err, nil)
 
 	type Inner struct {
-		EqCSFieldString  string
-		NeCSFieldString  string
-		GtCSFieldString  string
-		GteCSFieldString string
-		LtCSFieldString  string
-		LteCSFieldString string
+		EqCSFieldString    string
+		NeCSFieldString    string
+		GtCSFieldString    string
+		GteCSFieldString   string
+		LtCSFieldString    string
+		LteCSFieldString   string
+		RequiredIf         string
+		RequiredUnless     string
+		RequiredWith       string
+		RequiredWithAll    string
+		RequiredWithout    string
+		RequiredWithoutAll string
+		ExcludedIf         string
+		ExcludedUnless     string
+		ExcludedWith       string
+		ExcludedWithAll    string
+		ExcludedWithout    string
+		ExcludedWithoutAll string
 	}
 
 	type Test struct {
@@ -35,6 +47,19 @@ func TestTranslations(t *testing.T) {
 		RequiredString        string    `validate:"required"`
 		RequiredNumber        int       `validate:"required"`
 		RequiredMultiple      []string  `validate:"required"`
+		RequiredIf            string    `validate:"required_if=Inner.RequiredIf abcd"`
+		RequiredUnless        string    `validate:"required_unless=Inner.RequiredUnless abcd"`
+		RequiredWith          string    `validate:"required_with=Inner.RequiredWith"`
+		RequiredWithAll       string    `validate:"required_with_all=Inner.RequiredWith Inner.RequiredWithAll"`
+		RequiredWithout       string    `validate:"required_without=Inner.RequiredWithout"`
+		RequiredWithoutAll    string    `validate:"required_without_all=Inner.RequiredWithout Inner.RequiredWithoutAll"`
+		ExcludedIf            string    `validate:"excluded_if=Inner.ExcludedIf abcd"`
+		ExcludedUnless        string    `validate:"excluded_unless=Inner.ExcludedUnless abcd"`
+		ExcludedWith          string    `validate:"excluded_with=Inner.ExcludedWith"`
+		ExcludedWithout       string    `validate:"excluded_with_all=Inner.ExcludedWithAll"`
+		ExcludedWithAll       string    `validate:"excluded_without=Inner.ExcludedWithout"`
+		ExcludedWithoutAll    string    `validate:"excluded_without_all=Inner.ExcludedWithoutAll"`
+		IsDefault             string    `validate:"isdefault"`
 		LenString             string    `validate:"len=1"`
 		LenNumber             float64   `validate:"len=1113.00"`
 		LenMultiple           []string  `validate:"len=7"`
@@ -149,7 +174,7 @@ func TestTranslations(t *testing.T) {
 		LowercaseString       string    `validate:"lowercase"`
 		UppercaseString       string    `validate:"uppercase"`
 		Datetime              string    `validate:"datetime=2006-01-02"`
-		Image			  string			`validate:"image"`
+		Image                 string    `validate:"image"`
 	}
 
 	var test Test
@@ -157,6 +182,21 @@ func TestTranslations(t *testing.T) {
 	test.Inner.EqCSFieldString = "1234"
 	test.Inner.GtCSFieldString = "1234"
 	test.Inner.GteCSFieldString = "1234"
+	test.Inner.RequiredIf = "abcd"
+	test.Inner.RequiredUnless = "1234"
+	test.Inner.RequiredWith = "1234"
+	test.Inner.RequiredWithAll = "1234"
+	test.Inner.ExcludedIf = "abcd"
+	test.Inner.ExcludedUnless = "1234"
+	test.Inner.ExcludedWith = "1234"
+	test.Inner.ExcludedWithAll = "1234"
+
+	test.ExcludedIf = "1234"
+	test.ExcludedUnless = "1234"
+	test.ExcludedWith = "1234"
+	test.ExcludedWithAll = "1234"
+	test.ExcludedWithout = "1234"
+	test.ExcludedWithoutAll = "1234"
 
 	test.MaxString = "1234"
 	test.MaxNumber = 2000
@@ -630,6 +670,50 @@ func TestTranslations(t *testing.T) {
 			ns:       "Test.RequiredMultiple",
 			expected: "RequiredMultiple为必填字段",
 		},
+		{
+			ns:       "Test.RequiredUnless",
+			expected: "RequiredUnless为必填字段",
+		},
+		{
+			ns:       "Test.RequiredWith",
+			expected: "RequiredWith为必填字段",
+		},
+		{
+			ns:       "Test.RequiredWithAll",
+			expected: "RequiredWithAll为必填字段",
+		},
+		{
+			ns:       "Test.RequiredWithout",
+			expected: "RequiredWithout为必填字段",
+		},
+		{
+			ns:       "Test.RequiredWithoutAll",
+			expected: "RequiredWithoutAll为必填字段",
+		},
+		{
+			ns:       "Test.ExcludedIf",
+			expected: "ExcludedIf为禁填字段",
+		},
+		{
+			ns:       "Test.ExcludedUnless",
+			expected: "ExcludedUnless为禁填字段",
+		},
+		{
+			ns:       "Test.ExcludedWith",
+			expected: "ExcludedWith为禁填字段",
+		},
+		{
+			ns:       "Test.ExcludedWithAll",
+			expected: "ExcludedWithAll为禁填字段",
+		},
+		{
+			ns:       "Test.ExcludedWithout",
+			expected: "ExcludedWithout为禁填字段",
+		},
+		{
+			ns:       "Test.ExcludedWithoutAll",
+			expected: "ExcludedWithoutAll为禁填字段",
+		},
 		{
 			ns:       "Test.StrPtrMinLen",
 			expected: "StrPtrMinLen长度必须至少为10个字符",
@@ -683,7 +767,7 @@ func TestTranslations(t *testing.T) {
 			expected: "Datetime的格式必须是2006-01-02",
 		},
 		{
-			ns: "Test.Image",
+			ns:       "Test.Image",
 			expected: "Image 必须是有效图像",
 		},
 	}
diff --git a/translations/zh_tw/zh_tw_test.go b/translations/zh_tw/zh_tw_test.go
index e106363..1385c19 100644
--- a/translations/zh_tw/zh_tw_test.go
+++ b/translations/zh_tw/zh_tw_test.go
@@ -28,6 +28,18 @@ func TestTranslations(t *testing.T) {
 		GteCSFieldString string
 		LtCSFieldString  string
 		LteCSFieldString string
+		RequiredIf         string
+		RequiredUnless     string
+		RequiredWith       string
+		RequiredWithAll    string
+		RequiredWithout    string
+		RequiredWithoutAll string
+		ExcludedIf         string
+		ExcludedUnless     string
+		ExcludedWith       string
+		ExcludedWithAll    string
+		ExcludedWithout    string
+		ExcludedWithoutAll string
 	}
 
 	type Test struct {
@@ -35,6 +47,19 @@ func TestTranslations(t *testing.T) {
 		RequiredString    string    `validate:"required"`
 		RequiredNumber    int       `validate:"required"`
 		RequiredMultiple  []string  `validate:"required"`
+		RequiredIf             string    `validate:"required_if=Inner.RequiredIf abcd"`
+		RequiredUnless        string    `validate:"required_unless=Inner.RequiredUnless abcd"`
+		RequiredWith          string    `validate:"required_with=Inner.RequiredWith"`
+		RequiredWithAll       string    `validate:"required_with_all=Inner.RequiredWith Inner.RequiredWithAll"`
+		RequiredWithout       string    `validate:"required_without=Inner.RequiredWithout"`
+		RequiredWithoutAll    string    `validate:"required_without_all=Inner.RequiredWithout Inner.RequiredWithoutAll"`
+		ExcludedIf            string    `validate:"excluded_if=Inner.ExcludedIf abcd"`
+		ExcludedUnless        string    `validate:"excluded_unless=Inner.ExcludedUnless abcd"`
+		ExcludedWith          string    `validate:"excluded_with=Inner.ExcludedWith"`
+		ExcludedWithout       string    `validate:"excluded_with_all=Inner.ExcludedWithAll"`
+		ExcludedWithAll       string    `validate:"excluded_without=Inner.ExcludedWithout"`
+		ExcludedWithoutAll    string    `validate:"excluded_without_all=Inner.ExcludedWithoutAll"`
+		IsDefault             string    `validate:"isdefault"`
 		LenString         string    `validate:"len=1"`
 		LenNumber         float64   `validate:"len=1113.00"`
 		LenMultiple       []string  `validate:"len=7"`
@@ -149,6 +174,21 @@ func TestTranslations(t *testing.T) {
 	test.Inner.EqCSFieldString = "1234"
 	test.Inner.GtCSFieldString = "1234"
 	test.Inner.GteCSFieldString = "1234"
+	test.Inner.RequiredIf = "abcd"
+	test.Inner.RequiredUnless = "1234"
+	test.Inner.RequiredWith = "1234"
+	test.Inner.RequiredWithAll = "1234"
+	test.Inner.ExcludedIf = "abcd"
+	test.Inner.ExcludedUnless = "1234"
+	test.Inner.ExcludedWith = "1234"
+	test.Inner.ExcludedWithAll = "1234"
+
+	test.ExcludedIf = "1234"
+	test.ExcludedUnless = "1234"
+	test.ExcludedWith = "1234"
+	test.ExcludedWithAll = "1234"
+	test.ExcludedWithout = "1234"
+	test.ExcludedWithoutAll = "1234"
 
 	test.MaxString = "1234"
 	test.MaxNumber = 2000
@@ -592,6 +632,50 @@ func TestTranslations(t *testing.T) {
 			ns:       "Test.RequiredMultiple",
 			expected: "RequiredMultiple為必填欄位",
 		},
+		{
+			ns:       "Test.RequiredUnless",
+			expected: "RequiredUnless為必填欄位",
+		},
+		{
+			ns:       "Test.RequiredWith",
+			expected: "RequiredWith為必填欄位",
+		},
+		{
+			ns:       "Test.RequiredWithAll",
+			expected: "RequiredWithAll為必填欄位",
+		},
+		{
+			ns:       "Test.RequiredWithout",
+			expected: "RequiredWithout為必填欄位",
+		},
+		{
+			ns:       "Test.RequiredWithoutAll",
+			expected: "RequiredWithoutAll為必填欄位",
+		},
+		{
+			ns:       "Test.ExcludedIf",
+			expected: "ExcludedIf為禁填欄位",
+		},
+		{
+			ns:       "Test.ExcludedUnless",
+			expected: "ExcludedUnless為禁填欄位",
+		},
+		{
+			ns:       "Test.ExcludedWith",
+			expected: "ExcludedWith為禁填欄位",
+		},
+		{
+			ns:       "Test.ExcludedWithAll",
+			expected: "ExcludedWithAll為禁填欄位",
+		},
+		{
+			ns:       "Test.ExcludedWithout",
+			expected: "ExcludedWithout為禁填欄位",
+		},
+		{
+			ns:       "Test.ExcludedWithoutAll",
+			expected: "ExcludedWithoutAll為禁填欄位",
+		},
 		{
 			ns:       "Test.StrPtrMinLen",
 			expected: "StrPtrMinLen長度必須至少為10個字元",