From 5c7ac0593d4da5dfdc169246f813d585245288d9 Mon Sep 17 00:00:00 2001 From: "a.bouhuolia" Date: Mon, 3 Jan 2022 18:31:52 +0200 Subject: [PATCH] feat(GlobalErrors): localize the global errors. --- src/containers/GlobalErrors/GlobalErrors.js | 11 +++++------ src/lang/ar/index.json | 6 +++++- src/lang/en/index.json | 6 +++++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/containers/GlobalErrors/GlobalErrors.js b/src/containers/GlobalErrors/GlobalErrors.js index 513715753..eb35dae2e 100644 --- a/src/containers/GlobalErrors/GlobalErrors.js +++ b/src/containers/GlobalErrors/GlobalErrors.js @@ -43,7 +43,7 @@ function GlobalErrors({ if (globalErrors.access_denied) { toastKeySomethingWrong = AppToaster.show( { - message: 'You do not have permissions to access this page.', + message: intl.get('global_error.you_dont_have_permissions'), intent: Intent.DANGER, onDismiss: () => { globalErrorsSet({ access_denied: false }); @@ -53,11 +53,10 @@ function GlobalErrors({ ); } if (globalErrors.transactionsLocked) { - const lockedToDate = - globalErrors.transactionsLocked.formatted_locked_to_date; - AppToaster.show({ - message: `Transactions before ${lockedToDate} has been locked. Hence action cannot be performed.`, + message: intl.get('global_error.transactions_locked', { + lockedToDate: globalErrors.transactionsLocked.formatted_locked_to_date, + }), intent: Intent.DANGER, onDismiss: () => { globalErrorsSet({ transactionsLocked: false }); @@ -66,7 +65,7 @@ function GlobalErrors({ } if (globalErrors.userInactive) { AppToaster.show({ - message: 'The authorized user is inactive.', + message: intl.get('global_error.authorized_user_inactive'), intent: Intent.DANGER, onDismiss: () => { globalErrorsSet({ userInactive: false }); diff --git a/src/lang/ar/index.json b/src/lang/ar/index.json index 97c82f290..98d4f0356 100644 --- a/src/lang/ar/index.json +++ b/src/lang/ar/index.json @@ -1753,5 +1753,9 @@ "payment_receive.drawer.title": "تفاصيل سند الزبون ({number})", "payment_made.drawer.title": "تفاصيل سند المورد {number}", "manual_journal.drawer.title": "تفاصيل قيد يدوي ({number})", - "expense.drawer.title": " تفاصيل المصروف" + "expense.drawer.title": " تفاصيل المصروف", + + "global_error.you_dont_have_permissions": "ليس لديك صلاحية الوصول إلى هذه الصفحة.", + "global_error.transactions_locked": "تم قفل المعاملات التي تمت قبل {lockedToDate}. ومن ثم لا يمكن القيام بأي عمل.", + "global_error.authorized_user_inactive": "المستخدم المصرح له تم تعطيلة." } \ No newline at end of file diff --git a/src/lang/en/index.json b/src/lang/en/index.json index 14a6cca5b..51cc47d1d 100644 --- a/src/lang/en/index.json +++ b/src/lang/en/index.json @@ -1733,5 +1733,9 @@ "payment_receive.drawer.title": "Payment receive details ({number})", "payment_made.drawer.title": "Payment made details {number}", "manual_journal.drawer.title": "Manual journal details ({number})", - "expense.drawer.title": "Expense details" + "expense.drawer.title": "Expense details", + + "global_error.you_dont_have_permissions": "You do not have permissions to access this page.", + "global_error.transactions_locked": "Transactions before {lockedToDate} has been locked. Hence action cannot be performed.", + "global_error.authorized_user_inactive": "The authorized user is inactive." } \ No newline at end of file