From a8aa410ad350f550bc60e82f4beda32eb064528f Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Tue, 2 Jul 2024 15:31:38 +0200 Subject: [PATCH] also translate the message (#30654) fixes: #29098 Signed-off-by: Erik Jan de Wit --- js/libs/ui-shared/src/user-profile/utils.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/js/libs/ui-shared/src/user-profile/utils.ts b/js/libs/ui-shared/src/user-profile/utils.ts index 4009c66ae2..a86e760308 100644 --- a/js/libs/ui-shared/src/user-profile/utils.ts +++ b/js/libs/ui-shared/src/user-profile/utils.ts @@ -67,13 +67,16 @@ export function setUserProfileServerError( ).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", }); });