Skip to content

Commit f9a5a1f

Browse files
ryanmalesicRyan Malesic
andauthored
feat(translation): add en translation for urn_rfc2141 (#1431)
## Fixes Or Enhances Add en translation for urn_rfc2141 **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 Co-authored-by: Ryan Malesic <rymalesi@amazon.com>
1 parent 20f7df6 commit f9a5a1f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

translations/en/en.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,11 @@ func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (er
12291229
translation: "{0} must be a valid ISSN number",
12301230
override: false,
12311231
},
1232+
{
1233+
tag: "urn_rfc2141",
1234+
translation: "{0} must be a valid RFC 2141 URN",
1235+
override: false,
1236+
},
12321237
{
12331238
tag: "uuid",
12341239
translation: "{0} must be a valid UUID",

translations/en/en_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ func TestTranslations(t *testing.T) {
129129
ISBN10 string `validate:"isbn10"`
130130
ISBN13 string `validate:"isbn13"`
131131
ISSN string `validate:"issn"`
132+
URN string `validate:"urn_rfc2141"`
132133
UUID string `validate:"uuid"`
133134
UUID3 string `validate:"uuid3"`
134135
UUID4 string `validate:"uuid4"`
@@ -406,6 +407,10 @@ func TestTranslations(t *testing.T) {
406407
ns: "Test.ISSN",
407408
expected: "ISSN must be a valid ISSN number",
408409
},
410+
{
411+
ns: "Test.URN",
412+
expected: "URN must be a valid RFC 2141 URN",
413+
},
409414
{
410415
ns: "Test.Excludes",
411416
expected: "Excludes cannot contain the text 'text'",

0 commit comments

Comments
 (0)