-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(locales): improve Dutch (nl) localization #5367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(locales): improve Dutch (nl) localization #5367
Conversation
- Add missing 'verb' property to Sizable object for consistency with other locales - Fix error messages: 'Te lang/Te kort' -> 'Te groot/Te klein' to properly match English 'Too big/Too small' - Update error message structure to use verb property correctly - Add comprehensive test coverage for Dutch locale Fixes inconsistencies with other locale implementations and improves translation accuracy.
WalkthroughThis change introduces Dutch locale error message handling by adding test coverage and updating the locale implementation. A new test file validates four error scenarios for the Dutch locale—invalid type, size violations (too big/small), and format errors. The locale module itself expands its sizing metadata to include both a Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
packages/zod/src/v4/core/tests/locales/nl.test.ts (1)
16-24: Consider reviewing Dutch grammar with a native speaker.The phrase "verwacht dat string te hebben <=10 tekens" uses an infinitive construction that feels a bit unnatural in Dutch. More idiomatic alternatives might be:
- "verwacht dat string <=10 tekens heeft" (finite verb)
- "verwacht maximaal 10 tekens voor string"
The test correctly validates the current implementation, but you might want to verify the phrasing with a native Dutch speaker to ensure it sounds natural.
packages/zod/src/v4/locales/nl.ts (2)
80-86: Remove unnecessary nullish coalescing onsizing.unit.If
sizingexists,sizing.unitis always defined per your type definition. The?? "elementen"fallback on line 84 is unnecessary.Apply this diff:
- return `Te groot: verwacht dat ${issue.origin ?? "waarde"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementen"}`; + return `Te groot: verwacht dat ${issue.origin ?? "waarde"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit}`;
87-95: Inconsistent handling ofissue.originfallback.Line 84 uses
issue.origin ?? "waarde"but lines 91 and 94 use justissue.originwithout the fallback. For consistency, either bothtoo_bigandtoo_smallshould have the fallback, or neither should.Consider applying this diff to align with line 84:
- return `Te klein: verwacht dat ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`; + return `Te klein: verwacht dat ${issue.origin ?? "waarde"} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;- return `Te klein: verwacht dat ${issue.origin} ${adj}${issue.minimum.toString()} is`; + return `Te klein: verwacht dat ${issue.origin ?? "waarde"} ${adj}${issue.minimum.toString()} is`;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/zod/src/v4/core/tests/locales/nl.test.ts(1 hunks)packages/zod/src/v4/locales/nl.ts(2 hunks)
🔇 Additional comments (6)
packages/zod/src/v4/core/tests/locales/nl.test.ts (4)
1-2: Imports look good.Clean and minimal—just what you need for testing the Dutch locale.
7-14: LGTM!The invalid_type test case correctly validates the Dutch error message for type mismatches.
26-34: Good coverage of the exclusive bound case.Nice that you're testing with
inclusive: falseto verify the>operator is used correctly in the message.
36-42: LGTM!The invalid_format test case validates the email format error message correctly.
packages/zod/src/v4/locales/nl.ts (2)
6-11: Consistent structure across all sizable types.Good that you've added the verb property to all entries. The type structure is clean and consistent.
13-15: LGTM!The updated return type correctly reflects the new structure with both unit and verb properties.
- Add required input property to test cases to match TypeScript interface requirements - Ensures tests pass type checking while maintaining test coverage
|
Love it, thanks! Merging now, should land soon. |
Summary
Fixes critical inconsistencies in the Dutch locale implementation to match the structure and accuracy of other locales.
Issues Fixed
verbproperty inSizableobject causing incorrect error message formattingChanges
verb: "te hebben"to all Sizable entries for consistencyTesting
nl.test.tswith coverage for key error scenariosBefore/After
Before: "Te lang: verwacht dat string <=10 tekens bevat"
After: "Te groot: verwacht dat string te hebben <=10 tekens"
Fixes translation accuracy and maintains consistency with the established locale architecture.