Skip to content

Commit 34a626f

Browse files
committed
docs: tighten the z.locales tree-shaking note
1 parent 9d5e60f commit 34a626f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎packages/docs/content/error-customization.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ async function loadLocale(locale: string) {
338338
await loadLocale("fr");
339339
```
340340

341-
For convenience, all locales are also exported as `z.locales`, so `z.config(z.locales.de())` works without the extra import. Rollup and Webpack tree-shake that down to the locales you actually use. esbuild ([evanw/esbuild#1420](https://github.com/evanw/esbuild/issues/1420)) and Turbopack bundle every locale, whichever import form you use, so stick to `zod/locales` if you bundle with either.
341+
All locales are also exported as `z.locales`. Rollup and Webpack tree-shake that down to the ones you use; esbuild ([evanw/esbuild#1420](https://github.com/evanw/esbuild/issues/1420)) and Turbopack don't.
342342

343343
With your own translation function, the `error` param is called during `.parse()`, not when the schema is constructed — a schema defined once picks up the current language on every parse. To translate at render time, translate the issue itself: `code` is the key, and the issue's other properties are the interpolation values.
344344

0 commit comments

Comments
 (0)