zod 4.2.0-canary.20251017T221623 → 4.2.0-canary.20251021T172355
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/v4/core/tests/locales/nl.test.ts +46 -0
- package/src/v4/locales/nl.ts +10 -10
- package/v4/locales/nl.cjs +8 -8
- package/v4/locales/nl.js +8 -8
package/package.json
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { expect, test } from "vitest";
|
|
2
|
+
import nl from "../../../locales/nl.js";
|
|
3
|
+
|
|
4
|
+
test("Dutch locale error messages", () => {
|
|
5
|
+
const { localeError } = nl();
|
|
6
|
+
|
|
7
|
+
// Test invalid_type
|
|
8
|
+
expect(
|
|
9
|
+
localeError({
|
|
10
|
+
code: "invalid_type",
|
|
11
|
+
expected: "string",
|
|
12
|
+
input: 123,
|
|
13
|
+
})
|
|
14
|
+
).toBe("Ongeldige invoer: verwacht string, ontving getal");
|
|
15
|
+
|
|
16
|
+
// Test too_big with sizing
|
|
17
|
+
expect(
|
|
18
|
+
localeError({
|
|
19
|
+
code: "too_big",
|
|
20
|
+
origin: "string",
|
|
21
|
+
maximum: 10,
|
|
22
|
+
inclusive: true,
|
|
23
|
+
input: "test string that is too long",
|
|
24
|
+
})
|
|
25
|
+
).toBe("Te groot: verwacht dat string te hebben <=10 tekens");
|
|
26
|
+
|
|
27
|
+
// Test too_small with sizing
|
|
28
|
+
expect(
|
|
29
|
+
localeError({
|
|
30
|
+
code: "too_small",
|
|
31
|
+
origin: "array",
|
|
32
|
+
minimum: 5,
|
|
33
|
+
inclusive: false,
|
|
34
|
+
input: [1, 2],
|
|
35
|
+
})
|
|
36
|
+
).toBe("Te klein: verwacht dat array te hebben >5 elementen");
|
|
37
|
+
|
|
38
|
+
// Test invalid_format
|
|
39
|
+
expect(
|
|
40
|
+
localeError({
|
|
41
|
+
code: "invalid_format",
|
|
42
|
+
format: "email",
|
|
43
|
+
input: "invalid-email",
|
|
44
|
+
})
|
|
45
|
+
).toBe("Ongeldig: emailadres");
|
|
46
|
+
});
|
package/src/v4/locales/nl.ts
CHANGED
|
@@ -3,14 +3,14 @@ import type * as errors from "../core/errors.js";
|
|
|
3
3
|
import * as util from "../core/util.js";
|
|
4
4
|
|
|
5
5
|
const error: () => errors.$ZodErrorMap = () => {
|
|
6
|
-
const Sizable: Record<string, { unit: string }> = {
|
|
7
|
-
string: { unit: "tekens" },
|
|
8
|
-
file: { unit: "bytes" },
|
|
9
|
-
array: { unit: "elementen" },
|
|
10
|
-
set: { unit: "elementen" },
|
|
6
|
+
const Sizable: Record<string, { unit: string; verb: string }> = {
|
|
7
|
+
string: { unit: "tekens", verb: "te hebben" },
|
|
8
|
+
file: { unit: "bytes", verb: "te hebben" },
|
|
9
|
+
array: { unit: "elementen", verb: "te hebben" },
|
|
10
|
+
set: { unit: "elementen", verb: "te hebben" },
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
function getSizing(origin: string): { unit: string } | null {
|
|
13
|
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
|
14
14
|
return Sizable[origin] ?? null;
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -81,17 +81,17 @@ const error: () => errors.$ZodErrorMap = () => {
|
|
|
81
81
|
const adj = issue.inclusive ? "<=" : "<";
|
|
82
82
|
const sizing = getSizing(issue.origin);
|
|
83
83
|
if (sizing)
|
|
84
|
-
return `Te
|
|
85
|
-
return `Te
|
|
84
|
+
return `Te groot: verwacht dat ${issue.origin ?? "waarde"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementen"}`;
|
|
85
|
+
return `Te groot: verwacht dat ${issue.origin ?? "waarde"} ${adj}${issue.maximum.toString()} is`;
|
|
86
86
|
}
|
|
87
87
|
case "too_small": {
|
|
88
88
|
const adj = issue.inclusive ? ">=" : ">";
|
|
89
89
|
const sizing = getSizing(issue.origin);
|
|
90
90
|
if (sizing) {
|
|
91
|
-
return `Te
|
|
91
|
+
return `Te klein: verwacht dat ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
return `Te
|
|
94
|
+
return `Te klein: verwacht dat ${issue.origin} ${adj}${issue.minimum.toString()} is`;
|
|
95
95
|
}
|
|
96
96
|
case "invalid_format": {
|
|
97
97
|
const _issue = issue as errors.$ZodStringFormatIssues;
|
package/v4/locales/nl.cjs
CHANGED
|
@@ -27,10 +27,10 @@ exports.default = default_1;
|
|
|
27
27
|
const util = __importStar(require("../core/util.cjs"));
|
|
28
28
|
const error = () => {
|
|
29
29
|
const Sizable = {
|
|
30
|
-
string: { unit: "tekens" },
|
|
31
|
-
file: { unit: "bytes" },
|
|
32
|
-
array: { unit: "elementen" },
|
|
33
|
-
set: { unit: "elementen" },
|
|
30
|
+
string: { unit: "tekens", verb: "te hebben" },
|
|
31
|
+
file: { unit: "bytes", verb: "te hebben" },
|
|
32
|
+
array: { unit: "elementen", verb: "te hebben" },
|
|
33
|
+
set: { unit: "elementen", verb: "te hebben" },
|
|
34
34
|
};
|
|
35
35
|
function getSizing(origin) {
|
|
36
36
|
return Sizable[origin] ?? null;
|
|
@@ -97,16 +97,16 @@ const error = () => {
|
|
|
97
97
|
const adj = issue.inclusive ? "<=" : "<";
|
|
98
98
|
const sizing = getSizing(issue.origin);
|
|
99
99
|
if (sizing)
|
|
100
|
-
return `Te
|
|
101
|
-
return `Te
|
|
100
|
+
return `Te groot: verwacht dat ${issue.origin ?? "waarde"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementen"}`;
|
|
101
|
+
return `Te groot: verwacht dat ${issue.origin ?? "waarde"} ${adj}${issue.maximum.toString()} is`;
|
|
102
102
|
}
|
|
103
103
|
case "too_small": {
|
|
104
104
|
const adj = issue.inclusive ? ">=" : ">";
|
|
105
105
|
const sizing = getSizing(issue.origin);
|
|
106
106
|
if (sizing) {
|
|
107
|
-
return `Te
|
|
107
|
+
return `Te klein: verwacht dat ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
108
108
|
}
|
|
109
|
-
return `Te
|
|
109
|
+
return `Te klein: verwacht dat ${issue.origin} ${adj}${issue.minimum.toString()} is`;
|
|
110
110
|
}
|
|
111
111
|
case "invalid_format": {
|
|
112
112
|
const _issue = issue;
|
package/v4/locales/nl.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as util from "../core/util.js";
|
|
2
2
|
const error = () => {
|
|
3
3
|
const Sizable = {
|
|
4
|
-
string: { unit: "tekens" },
|
|
5
|
-
file: { unit: "bytes" },
|
|
6
|
-
array: { unit: "elementen" },
|
|
7
|
-
set: { unit: "elementen" },
|
|
4
|
+
string: { unit: "tekens", verb: "te hebben" },
|
|
5
|
+
file: { unit: "bytes", verb: "te hebben" },
|
|
6
|
+
array: { unit: "elementen", verb: "te hebben" },
|
|
7
|
+
set: { unit: "elementen", verb: "te hebben" },
|
|
8
8
|
};
|
|
9
9
|
function getSizing(origin) {
|
|
10
10
|
return Sizable[origin] ?? null;
|
|
@@ -71,16 +71,16 @@ const error = () => {
|
|
|
71
71
|
const adj = issue.inclusive ? "<=" : "<";
|
|
72
72
|
const sizing = getSizing(issue.origin);
|
|
73
73
|
if (sizing)
|
|
74
|
-
return `Te
|
|
75
|
-
return `Te
|
|
74
|
+
return `Te groot: verwacht dat ${issue.origin ?? "waarde"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementen"}`;
|
|
75
|
+
return `Te groot: verwacht dat ${issue.origin ?? "waarde"} ${adj}${issue.maximum.toString()} is`;
|
|
76
76
|
}
|
|
77
77
|
case "too_small": {
|
|
78
78
|
const adj = issue.inclusive ? ">=" : ">";
|
|
79
79
|
const sizing = getSizing(issue.origin);
|
|
80
80
|
if (sizing) {
|
|
81
|
-
return `Te
|
|
81
|
+
return `Te klein: verwacht dat ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
82
82
|
}
|
|
83
|
-
return `Te
|
|
83
|
+
return `Te klein: verwacht dat ${issue.origin} ${adj}${issue.minimum.toString()} is`;
|
|
84
84
|
}
|
|
85
85
|
case "invalid_format": {
|
|
86
86
|
const _issue = issue;
|