From b150d19a563fa3356cdcdee0f75015f5c4e99b90 Mon Sep 17 00:00:00 2001 From: David Roizenman Date: Mon, 20 Oct 2025 00:51:54 -0700 Subject: [PATCH 1/2] fix: incorrect nl localization for too_big and too_small --- packages/zod/src/v4/locales/nl.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/zod/src/v4/locales/nl.ts b/packages/zod/src/v4/locales/nl.ts index 266ba53301..8c3f53341e 100644 --- a/packages/zod/src/v4/locales/nl.ts +++ b/packages/zod/src/v4/locales/nl.ts @@ -3,15 +3,15 @@ import type * as errors from "../core/errors.js"; import * as util from "../core/util.js"; const error: () => errors.$ZodErrorMap = () => { - const Sizable: Record = { - string: { unit: "tekens" }, - file: { unit: "bytes" }, - array: { unit: "elementen" }, - set: { unit: "elementen" }, - }; + const Sizable = { + string: { big: 'lang', small: 'kort', unit: "tekens" }, + file: { big: 'groot', small: 'klein', unit: "bytes" }, + array: { big: 'veel', small: 'weining', unit: "elementen" }, + set: { big: 'veel', small: 'weining', unit: "elementen" }, + } satisfies Record ; - function getSizing(origin: string): { unit: string } | null { - return Sizable[origin] ?? null; + function getSizing(origin: string): typeof Sizable[keyof typeof Sizable] | null { + return Sizable[origin as keyof typeof Sizable] ?? null; } const parsedType = (data: any): string => { @@ -81,17 +81,17 @@ const error: () => errors.$ZodErrorMap = () => { const adj = issue.inclusive ? "<=" : "<"; const sizing = getSizing(issue.origin); if (sizing) - return `Te lang: verwacht dat ${issue.origin ?? "waarde"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementen"} bevat`; - return `Te lang: verwacht dat ${issue.origin ?? "waarde"} ${adj}${issue.maximum.toString()} is`; + return `Te ${sizing.big}: verwachtte ${issue.origin} met ${adj}${issue.maximum.toString()} ${sizing.unit}`; + return `Te groot: waarde moet ${adj}${issue.maximum.toString()} is`; } case "too_small": { const adj = issue.inclusive ? ">=" : ">"; const sizing = getSizing(issue.origin); if (sizing) { - return `Te kort: verwacht dat ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit} bevat`; + return `Te ${sizing.small}: verwachtte ${issue.origin} met ${adj}${issue.minimum.toString()} ${sizing.unit}`; } - return `Te kort: verwacht dat ${issue.origin} ${adj}${issue.minimum.toString()} is`; + return `Te klein: waarde moet ${adj}${issue.minimum.toString()} is`; } case "invalid_format": { const _issue = issue as errors.$ZodStringFormatIssues; From 44f2edc5548ea9e9876a833160ea06310d8625a9 Mon Sep 17 00:00:00 2001 From: David Roizenman Date: Mon, 20 Oct 2025 01:34:30 -0700 Subject: [PATCH 2/2] format --- packages/zod/src/v4/locales/nl.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/zod/src/v4/locales/nl.ts b/packages/zod/src/v4/locales/nl.ts index 8c3f53341e..4cd79ef2dd 100644 --- a/packages/zod/src/v4/locales/nl.ts +++ b/packages/zod/src/v4/locales/nl.ts @@ -4,13 +4,13 @@ import * as util from "../core/util.js"; const error: () => errors.$ZodErrorMap = () => { const Sizable = { - string: { big: 'lang', small: 'kort', unit: "tekens" }, - file: { big: 'groot', small: 'klein', unit: "bytes" }, - array: { big: 'veel', small: 'weining', unit: "elementen" }, - set: { big: 'veel', small: 'weining', unit: "elementen" }, - } satisfies Record ; + string: { big: "lang", small: "kort", unit: "tekens" }, + file: { big: "groot", small: "klein", unit: "bytes" }, + array: { big: "veel", small: "weining", unit: "elementen" }, + set: { big: "veel", small: "weining", unit: "elementen" }, + } satisfies Record; - function getSizing(origin: string): typeof Sizable[keyof typeof Sizable] | null { + function getSizing(origin: string): (typeof Sizable)[keyof typeof Sizable] | null { return Sizable[origin as keyof typeof Sizable] ?? null; }