Repository: go-playground/validator
Pull request #694 (2020-11-29 18:12:28)

add it_IT translation
## Fixes Or Enhances


**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/admins

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

Coverage decreased (-0.5%) to 75.574% when pulling **f9442423904af2d1fb87b0ace0a54751794d1e96 on mrkongo:add-it_IT-translation** into **f6584a41c8acc5dfc0b62f7962811f5231c11530 on go-playground:master**.

mrkongo: @deankarn do you think there is still a long way to go for this PR to merge?

Patch:
diff --git a/translations/it/it.go b/translations/it/it.go
index 8abd67f..0b46fc4 100644
--- a/translations/it/it.go
+++ b/translations/it/it.go
@@ -1,4 +1,4 @@
-package en
+package it
 
 import (
 	"fmt"
@@ -28,6 +28,11 @@ func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (er
 			translation: "{0} è un campo obbligatorio",
 			override:    false,
 		},
+		{
+			tag:         "required_without",
+			translation: "{0} è un campo obbligatorio",
+			override:    false,
+		},
 		{
 			tag: "len",
 			customRegisFunc: func(ut ut.Translator) (err error) {
@@ -119,6 +124,7 @@ func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (er
 		{
 			tag: "min",
 			customRegisFunc: func(ut ut.Translator) (err error) {
+        
 				if err = ut.Add("min-string", "{0} deve essere lungo almeno {1}", false); err != nil {
 					return
 				}
@@ -150,6 +156,7 @@ func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (er
 			},
 			customTransFunc: func(ut ut.Translator, fe validator.FieldError) string {
 				var err error
+
 				var t string
 
 				var digits uint64
@@ -320,6 +327,7 @@ func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (er
 				}
 
 				if err = ut.Add("lt-number", "{0} deve essere minore di {1}", false); err != nil {
+
 					return
 				}
 
@@ -424,6 +432,7 @@ func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (er
 		{
 			tag: "lte",
 			customRegisFunc: func(ut ut.Translator) (err error) {
+        
 				if err = ut.Add("lte-string", "{0} deve essere lungo al massimo {1}", false); err != nil {
 					return
 				}
@@ -459,6 +468,7 @@ func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (er
 				return
 			},
 			customTransFunc: func(ut ut.Translator, fe validator.FieldError) string {
+
 				var err error
 				var t string
 				var f64 float64
@@ -541,6 +551,7 @@ func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (er
 		{
 			tag: "gt",
 			customRegisFunc: func(ut ut.Translator) (err error) {
+
 				if err = ut.Add("gt-string", "{0} deve essere lungo più di {1}", false); err != nil {
 					return
 				}
@@ -576,6 +587,7 @@ func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (er
 				return
 			},
 			customTransFunc: func(ut ut.Translator, fe validator.FieldError) string {
+
 				var err error
 				var t string
 				var f64 float64
@@ -693,6 +705,7 @@ func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (er
 				return
 			},
 			customTransFunc: func(ut ut.Translator, fe validator.FieldError) string {
+
 				var err error
 				var t string
 				var f64 float64
@@ -1195,7 +1208,6 @@ func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (er
 	}
 
 	for _, t := range translations {
-
 		if t.customTransFunc != nil && t.customRegisFunc != nil {
 			err = v.RegisterTranslation(t.tag, trans, t.customRegisFunc, t.customTransFunc)
 		} else if t.customTransFunc != nil && t.customRegisFunc == nil {


Test patch:
diff --git a/translations/it/it_test.go b/translations/it/it_test.go
index 301e8c1..98d2ab5 100644
--- a/translations/it/it_test.go
+++ b/translations/it/it_test.go
@@ -1,4 +1,4 @@
-package en
+package it
 
 import (
 	"testing"
@@ -11,9 +11,9 @@ import (
 )
 
 func TestTranslations(t *testing.T) {
-	it := italian.New()
-	uni := ut.New(it, it)
-	trans, _ := uni.GetTranslator("en")
+	ita := italian.New()
+	uni := ut.New(ita, ita)
+	trans, _ := uni.GetTranslator("it")
 
 	validate := validator.New()
 
@@ -198,6 +198,7 @@ func TestTranslations(t *testing.T) {
 
 	test.LowercaseString = "ABCDEFG"
 	test.UppercaseString = "abcdefg"
+
 	test.StartsWithString = "hello"
 	test.StartsNotWithString = "foo-hello"
 	test.EndsWithString = "hello"