Skip to content

Commit d4b426b

Browse files
authored
Merge pull request #7804 from knoid/localize-zod-messages
fix(zod): locale in use for Zod validator messages
2 parents 3cb6697 + 88c6bbc commit d4b426b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/common-breads-wait.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@qwik.dev/router': patch
3+
---
4+
5+
FIX: Zod validator uses defined locale for the current request

packages/qwik-router/src/runtime/src/server-functions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
noSerialize,
77
untrack,
88
useStore,
9+
withLocale,
910
type QRL,
1011
type ValueOrPromise,
1112
} from '@qwik.dev/core';
@@ -367,7 +368,7 @@ export const zodQrl: ZodConstructorQRL = (
367368
}
368369
});
369370
const data = inputData ?? (await ev.parseBody());
370-
const result = await schema.safeParseAsync(data);
371+
const result = await withLocale(ev.locale(), () => schema.safeParseAsync(data));
371372
if (result.success) {
372373
return result;
373374
} else {

0 commit comments

Comments
 (0)