From 2dea7220b815c21829f06e6f65b51e895cd9a176 Mon Sep 17 00:00:00 2001 From: Edouard Marquez Date: Mon, 7 Aug 2023 14:36:49 +0200 Subject: [PATCH 1/2] Support non english languages for Signup errors --- .../pages/user_management/sign_up_page.dart | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/smooth_app/lib/pages/user_management/sign_up_page.dart b/packages/smooth_app/lib/pages/user_management/sign_up_page.dart index 6541c4ba540..19a85209167 100644 --- a/packages/smooth_app/lib/pages/user_management/sign_up_page.dart +++ b/packages/smooth_app/lib/pages/user_management/sign_up_page.dart @@ -373,7 +373,23 @@ class _SignUpPageState extends State with TraceableClientMixin { _userFocusNode.requestFocus(); errorMessage = appLocalisations.sign_up_page_user_name_already_used; } else { - errorMessage = status.error; + // Let's try to find the error in + final Iterable allMatches = + RegExp('(
  • )(.*?)(
  • )') + .allMatches(status.error!); + if (allMatches.isNotEmpty) { + final StringBuffer buffer = StringBuffer(); + for (final RegExpMatch match in allMatches) { + if (buffer.isNotEmpty) { + buffer.write('\n\n'); + } + + buffer.write(match.group(2)); + } + errorMessage = buffer.toString(); + } else { + errorMessage = status.error; + } } } From 8cc5b0dccc58712337183df9ab6e784ad95423d1 Mon Sep 17 00:00:00 2001 From: Edouard Marquez Date: Mon, 7 Aug 2023 20:03:42 +0200 Subject: [PATCH 2/2] Hide warning --- packages/smooth_app/lib/pages/user_management/sign_up_page.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/smooth_app/lib/pages/user_management/sign_up_page.dart b/packages/smooth_app/lib/pages/user_management/sign_up_page.dart index 19a85209167..c76cc38d2e7 100644 --- a/packages/smooth_app/lib/pages/user_management/sign_up_page.dart +++ b/packages/smooth_app/lib/pages/user_management/sign_up_page.dart @@ -375,7 +375,7 @@ class _SignUpPageState extends State with TraceableClientMixin { } else { // Let's try to find the error in final Iterable allMatches = - RegExp('(
  • )(.*?)(
  • )') + RegExp('(
  • )(.*?)(
  • )') .allMatches(status.error!); if (allMatches.isNotEmpty) { final StringBuffer buffer = StringBuffer();