also translate the message (#30654)

fixes: #29098

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-07-02 15:31:38 +02:00 committed by GitHub
parent e3649eb86a
commit a8aa410ad3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -67,13 +67,16 @@ export function setUserProfileServerError<T>(
).forEach((e) => {
const params = Object.assign(
{},
e.params?.map((p) => t(isBundleKey(p.toString()) ? unWrap(p) : p)),
e.params?.map((p) => (isBundleKey(p.toString()) ? t(unWrap(p)) : p)),
);
setError(fieldName(e.field) as keyof T, {
message: t(e.errorMessage, {
...params,
defaultValue: e.errorMessage || e.field,
}),
message: t(
isBundleKey(e.errorMessage) ? unWrap(e.errorMessage) : e.errorMessage,
{
...params,
defaultValue: e.errorMessage || e.field,
},
),
type: "server",
});
});