From 70b7604b6c346e07baceb8a4006351aeb2a5bd38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 11 Jul 2018 20:17:46 +0200 Subject: [PATCH] Fix a bug with error.message not exposed to t() --- src/components/TranslatedError.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/TranslatedError.js b/src/components/TranslatedError.js index d5e8257c..cac520c0 100644 --- a/src/components/TranslatedError.js +++ b/src/components/TranslatedError.js @@ -30,14 +30,16 @@ class TranslatedError extends PureComponent { } return null } + // $FlowFixMe + const arg: Object = Object.assign({ message: error.message }, error) if (error.name) { - const translation = t(`errors:${error.name}.${field}`, error) + const translation = t(`errors:${error.name}.${field}`, arg) if (translation !== `${error.name}.${field}`) { // It is translated return translation } } - return t(`errors:generic.${field}`, error) + return t(`errors:generic.${field}`, arg) } }