Skip to content

Commit

Permalink
fix: Fix the validation message translations not occuring for Preview…
Browse files Browse the repository at this point in the history
… of Forms (#5028)

* * fix the validation messages for preview of forms.

* * Shift namespaces to const, and move translatedT function up beside OG T.
  • Loading branch information
ShadeWyrm authored Jan 24, 2025
1 parent 11df4fc commit 0da67db
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ export const Preview = ({
email: s.deliveryOption?.emailAddress,
}));

const { t } = useTranslation(["common", "form-builder", "form-closed"]);
const translationNamespaces = ["common", "form-builder", "form-closed"];
const { t } = useTranslation(translationNamespaces);
const translatedT = useTranslation(translationNamespaces, { lng: translationLanguagePriority }).t;

const language = translationLanguagePriority;
const currentForm = getRenderedForm(formRecord, language);

Expand Down Expand Up @@ -191,7 +194,7 @@ export const Preview = ({
saveProgress={saveProgress}
isPreview={true}
language={language}
t={t}
t={translatedT}
onSuccess={setSent}
renderSubmit={({ validateForm }) => {
return (
Expand Down

0 comments on commit 0da67db

Please sign in to comment.