English default
No locale option is configured, so bundled English fallback text is used.
Locale demo
English stays in the main bundle. Other messages are opt-in JSON or inline objects passed during initialization.
Back to demo gallerySubmit each empty form. Then enter an invalid email address and submit again to compare rule messages.
No locale option is configured, so bundled English fallback text is used.
The Spanish pack is imported from ./dist/locales/es.json and registered as es.
A small product-specific locale object is passed directly in the initialization options.
Locale lookup checks the explicit option first, then form or document language, then English. Field data messages and field-level message options still win over locale packs.
import esMessages from "./dist/locales/es.json" with { type: "json" };
createFormValidator(form, {
...createDefaultPreset(),
locale: "es",
locales: { es: esMessages }
});
createFormValidator(form, {
...createDefaultPreset(),
locale: "product",
locales: {
product: {
required: "{fieldLabel} is required.",
email: "Use a valid work email address."
}
}
});