@open-mercato/core 0.4.8-develop-665ca9216b → 0.4.8-develop-f3593949bf

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -585,6 +585,12 @@ function EditCatalogProductPage({
585
585
  );
586
586
  const handleSubmit = React.useCallback(
587
587
  async (formValues) => {
588
+ const translateValidationMessage = (message) => {
589
+ if (typeof message !== "string") return "";
590
+ const trimmed = message.trim();
591
+ if (!trimmed) return "";
592
+ return t(trimmed, trimmed);
593
+ };
588
594
  if (!productId) {
589
595
  throw createCrudFormError(
590
596
  t(
@@ -599,9 +605,11 @@ function EditCatalogProductPage({
599
605
  const fieldErrors = {};
600
606
  issues.forEach((issue) => {
601
607
  const path = issue.path.join(".") || "form";
602
- if (!fieldErrors[path]) fieldErrors[path] = issue.message;
608
+ if (!fieldErrors[path]) {
609
+ fieldErrors[path] = translateValidationMessage(issue.message);
610
+ }
603
611
  });
604
- const message = issues[0]?.message ?? t(
612
+ const message = translateValidationMessage(issues[0]?.message) || t(
605
613
  "catalog.products.edit.errors.validation",
606
614
  "Fix highlighted fields."
607
615
  );