Skip to content

Commit 3201fe4

Browse files
authored
Add FQDN en translation (#1058)
1 parent 5aa5f93 commit 3201fe4

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ _testmain.go
2828
*.txt
2929
cover.html
3030
README.html
31+
.idea

translations/en/en.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,6 +1266,11 @@ func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (er
12661266
translation: "{0} must contain a valid MAC address",
12671267
override: false,
12681268
},
1269+
{
1270+
tag: "fqdn",
1271+
translation: "{0} must be a valid FQDN",
1272+
override: false,
1273+
},
12691274
{
12701275
tag: "unique",
12711276
translation: "{0} must contain unique values",

translations/en/en_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ func TestTranslations(t *testing.T) {
130130
IPAddrv6 string `validate:"ip6_addr"`
131131
UinxAddr string `validate:"unix_addr"` // can't fail from within Go's net package currently, but maybe in the future
132132
MAC string `validate:"mac"`
133+
FQDN string `validate:"fqdn"`
133134
IsColor string `validate:"iscolor"`
134135
StrPtrMinLen *string `validate:"min=10"`
135136
StrPtrMaxLen *string `validate:"max=1"`
@@ -226,6 +227,10 @@ func TestTranslations(t *testing.T) {
226227
ns: "Test.MAC",
227228
expected: "MAC must contain a valid MAC address",
228229
},
230+
{
231+
ns: "Test.FQDN",
232+
expected: "FQDN must be a valid FQDN",
233+
},
229234
{
230235
ns: "Test.IPAddr",
231236
expected: "IPAddr must be a resolvable IP address",

0 commit comments

Comments
 (0)