From b2655a0ed2f0b3e63297fc0424df833cab721d7a Mon Sep 17 00:00:00 2001
From: elforjani3
Date: Thu, 10 Jun 2021 15:49:12 +0200
Subject: [PATCH] fix: react intl.
---
client/src/components/ContactsMultiSelect.js | 23 ++++++---------
client/src/components/Pagination.js | 14 ++++-----
.../containers/Accounts/AccountsActionsBar.js | 5 ++--
.../Authentication/InviteAcceptFormContent.js | 12 ++++----
.../containers/Authentication/RegisterForm.js | 12 ++++----
.../FinancialStatements/reducers.js | 3 +-
.../Bills/BillsLanding/components.js | 29 +++++++------------
.../Invoices/InvoicesLanding/components.js | 24 +++++----------
.../containers/Subscriptions/BillingPlan.js | 5 ++--
.../Subscriptions/BillingPlansForm.js | 7 +++--
client/src/lang/en/index.json | 5 ++--
11 files changed, 58 insertions(+), 81 deletions(-)
diff --git a/client/src/components/ContactsMultiSelect.js b/client/src/components/ContactsMultiSelect.js
index 7cbb1c332..9a480f66a 100644
--- a/client/src/components/ContactsMultiSelect.js
+++ b/client/src/components/ContactsMultiSelect.js
@@ -3,6 +3,7 @@ import { MenuItem, Button } from '@blueprintjs/core';
import { omit } from 'lodash';
import MultiSelect from 'components/MultiSelect';
import { FormattedMessage as T } from 'components';
+import intl from 'react-intl-universal';
export default function ContactsMultiSelect({
contacts,
@@ -31,9 +32,10 @@ export default function ContactsMultiSelect({
[isContactSelect],
);
- const countSelected = useMemo(() => Object.values(selectedContacts).length, [
- selectedContacts,
- ]);
+ const countSelected = useMemo(
+ () => Object.values(selectedContacts).length,
+ [selectedContacts],
+ );
const onContactSelect = useCallback(
({ id }) => {
@@ -50,12 +52,7 @@ export default function ContactsMultiSelect({
setSelectedContacts({ ...selected });
onContactSelected && onContactSelected(selected);
},
- [
- setSelectedContacts,
- selectedContacts,
- isContactSelect,
- onContactSelected,
- ],
+ [setSelectedContacts, selectedContacts, isContactSelect, onContactSelected],
);
return (
@@ -69,11 +66,9 @@ export default function ContactsMultiSelect({
>
- )
+ countSelected === 0
+ ? defaultText
+ : intl.get('selected_customers', { count: countSelected })
}
{...buttonProps}
/>
diff --git a/client/src/components/Pagination.js b/client/src/components/Pagination.js
index 27f9c3fe2..b3e16ab36 100644
--- a/client/src/components/Pagination.js
+++ b/client/src/components/Pagination.js
@@ -2,6 +2,7 @@ import React, { useReducer, useEffect } from 'react';
import classNames from 'classnames';
import { Button, ButtonGroup, Intent, HTMLSelect } from '@blueprintjs/core';
import { FormattedMessage as T } from 'components';
+import intl from 'react-intl-universal';
import PropTypes from 'prop-types';
import { range } from 'lodash';
import { Icon } from 'components';
@@ -204,14 +205,11 @@ function Pagination({
);
diff --git a/client/src/containers/Accounts/AccountsActionsBar.js b/client/src/containers/Accounts/AccountsActionsBar.js
index 25df336fa..2731c823e 100644
--- a/client/src/containers/Accounts/AccountsActionsBar.js
+++ b/client/src/containers/Accounts/AccountsActionsBar.js
@@ -13,6 +13,7 @@ import {
} from '@blueprintjs/core';
import classNames from 'classnames';
import { FormattedMessage as T } from 'components';
+import intl from 'react-intl-universal';
import { If, DashboardActionViewsList } from 'components';
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
@@ -104,7 +105,7 @@ function AccountsActionsBar({
true ? (
) : (
-
+ intl.get('count_filters_applied', { count: 0 })
)
}
icon={}
@@ -159,5 +160,5 @@ export default compose(
withAccounts(({ accountsSelectedRows }) => ({
accountsSelectedRows,
})),
- withAccountsTableActions
+ withAccountsTableActions,
)(AccountsActionsBar);
diff --git a/client/src/containers/Authentication/InviteAcceptFormContent.js b/client/src/containers/Authentication/InviteAcceptFormContent.js
index ad3d0e3a5..a5d063446 100644
--- a/client/src/containers/Authentication/InviteAcceptFormContent.js
+++ b/client/src/containers/Authentication/InviteAcceptFormContent.js
@@ -3,6 +3,7 @@ import { Button, InputGroup, Intent, FormGroup } from '@blueprintjs/core';
import { Form, ErrorMessage, FastField, useFormikContext } from 'formik';
import { Link } from 'react-router-dom';
import { FormattedMessage as T } from 'components';
+import intl from 'react-intl-universal';
import { inputIntent } from 'utils';
import { Col, Row } from 'components';
import { useInviteAcceptContext } from './InviteAcceptProvider';
@@ -108,13 +109,10 @@ export default function InviteUserFormContent() {
- {msg},
- privacy: (msg) => {msg},
- }}
- />
+ {intl.getHTML('signing_in_or_creating', {
+ terms: (msg) => {msg},
+ privacy: (msg) => {msg},
+ })}
diff --git a/client/src/containers/Authentication/RegisterForm.js b/client/src/containers/Authentication/RegisterForm.js
index 742e2db66..f634b2f42 100644
--- a/client/src/containers/Authentication/RegisterForm.js
+++ b/client/src/containers/Authentication/RegisterForm.js
@@ -8,6 +8,7 @@ import {
} from '@blueprintjs/core';
import { ErrorMessage, Field, Form } from 'formik';
import { FormattedMessage as T } from 'components';
+import intl from 'react-intl-universal';
import { Link } from 'react-router-dom';
import { Row, Col, If } from 'components';
import { PasswordRevealer } from './components';
@@ -117,13 +118,10 @@ export default function RegisterForm({ isSubmitting }) {
- {msg},
- privacy: (msg) => {msg},
- }}
- />
+ {intl.getHTML('signing_in_or_creating', {
+ terms: (msg) => {msg},
+ privacy: (msg) => {msg},
+ })}
diff --git a/client/src/containers/FinancialStatements/reducers.js b/client/src/containers/FinancialStatements/reducers.js
index 4e6edfcbf..7d6770764 100644
--- a/client/src/containers/FinancialStatements/reducers.js
+++ b/client/src/containers/FinancialStatements/reducers.js
@@ -2,6 +2,7 @@ import React from 'react';
import { chain } from 'lodash';
import moment from 'moment';
import { FormattedMessage as T } from 'components';
+import intl from 'react-intl-universal';
export const balanceSheetRowsReducer = (accounts) => {
return accounts.map((account) => {
@@ -12,7 +13,7 @@ export const balanceSheetRowsReducer = (accounts) => {
...(account.total && account.children && account.children.length > 0
? [
{
- name: ,
+ name: intl.get('total_name', { name: account.name }),
row_types: ['total-row', account.section_type],
total: { ...account.total },
...(account.total_periods && {
diff --git a/client/src/containers/Purchases/Bills/BillsLanding/components.js b/client/src/containers/Purchases/Bills/BillsLanding/components.js
index d7d42900b..34d299000 100644
--- a/client/src/containers/Purchases/Bills/BillsLanding/components.js
+++ b/client/src/containers/Purchases/Bills/BillsLanding/components.js
@@ -11,7 +11,7 @@ import {
ProgressBar,
} from '@blueprintjs/core';
import intl from 'react-intl-universal';
-import { FormattedMessage as T } from 'components';
+import { FormattedMessage as T } from 'components';
import { Icon, If, Choose, Money } from 'components';
import { safeCallback, isBlank, calculateStatus } from 'utils';
import moment from 'moment';
@@ -23,8 +23,6 @@ export function ActionsMenu({
payload: { onEdit, onOpen, onDelete, onQuick },
row: { original },
}) {
-
-
return (