WIP: Arabic localization.|

This commit is contained in:
a.bouhuolia
2021-06-10 12:51:00 +02:00
parent 4fc7c37260
commit 1ea32884c2
465 changed files with 3299 additions and 2109 deletions

View File

@@ -1,7 +1,7 @@
import React from 'react';
import Icon from 'components/Icon';
import { Button, Classes, NavbarGroup, Intent } from '@blueprintjs/core';
import { FormattedMessage as T } from 'react-intl';
import { FormattedMessage as T } from 'components';
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
import withDialogActions from 'containers/Dialog/withDialogActions';

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { FormattedMessage as T } from 'react-intl';
import { FormattedMessage as T } from 'components';
import { Icon, Money } from 'components';
/**

View File

@@ -3,7 +3,7 @@ import moment from 'moment';
import { Link } from 'react-router-dom';
import { useAccountDrawerContext } from './AccountDrawerProvider';
import { formatMessage } from 'services/intl';
import intl from 'react-intl-universal';
import { DataTable, Money } from 'components';
import { isBlank, compose } from 'utils';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
@@ -21,17 +21,17 @@ function AccountDrawerTable({ closeDrawer }) {
const columns = React.useMemo(
() => [
{
Header: formatMessage({ id: 'transaction_date' }),
Header: intl.get('transaction_date'),
accessor: ({ date }) => moment(date).format('YYYY MMM DD'),
width: 110,
},
{
Header: formatMessage({ id: 'transaction_type' }),
Header: intl.get('transaction_type'),
accessor: 'reference_type_formatted',
width: 100,
},
{
Header: formatMessage({ id: 'credit' }),
Header: intl.get('credit'),
accessor: ({ credit }) =>
!isBlank(credit) && credit !== 0 ? (
<Money amount={credit} currency={currency_code} />
@@ -39,7 +39,7 @@ function AccountDrawerTable({ closeDrawer }) {
width: 80,
},
{
Header: formatMessage({ id: 'debit' }),
Header: intl.get('debit'),
accessor: ({ debit }) =>
!isBlank(debit) && debit !== 0 ? (
<Money amount={debit} currency={currency_code} />
@@ -47,7 +47,7 @@ function AccountDrawerTable({ closeDrawer }) {
width: 80,
},
{
Header: formatMessage({ id: 'running_balance' }),
Header: intl.get('running_balance'),
accessor: ({ running_balance }) => (
<Money amount={running_balance} currency={currency_code} />
),
@@ -71,7 +71,7 @@ function AccountDrawerTable({ closeDrawer }) {
to={`/financial-reports/general-ledger`}
onClick={handleLinkClick}
>
{formatMessage({ id: 'view_more_transactions' })}
{intl.get('view_more_transactions')}
</Link>
</div>
</div>

View File

@@ -2,7 +2,7 @@ import React from 'react';
import { useHistory } from 'react-router-dom';
import Icon from 'components/Icon';
import { Button, Classes, NavbarGroup, Intent } from '@blueprintjs/core';
import { FormattedMessage as T } from 'react-intl';
import { FormattedMessage as T } from 'components';
import { safeCallback } from 'utils';
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { If, Money } from 'components';
import { FormattedMessage as T } from 'react-intl';
import { FormattedMessage as T } from 'components';
export default function ExpenseDrawerFooter({
expense: { total_amount, currency_code },

View File

@@ -1,7 +1,7 @@
import React from 'react';
import moment from 'moment';
import { If, Money } from 'components';
import { FormattedMessage as T } from 'react-intl';
import { FormattedMessage as T } from 'components';
/**
* Expense drawer content.

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { formatMessage } from 'services/intl';
import intl from 'react-intl-universal';
import { DataTable, Money } from 'components';
/**
@@ -12,19 +12,19 @@ export default function ExpenseDrawerTable({
const columns = React.useMemo(
() => [
{
Header: formatMessage({ id: 'expense_account' }),
Header: intl.get('expense_account'),
accessor: 'expense_account.name',
width: 110,
},
{
Header: formatMessage({ id: 'amount' }),
Header: intl.get('amount'),
accessor: ({ amount }) => (
<Money amount={amount} currency={currency_code} />
),
width: 100,
},
{
Header: formatMessage({ id: 'description' }),
Header: intl.get('description'),
accessor: 'description',
width: 110,
},

View File

@@ -2,7 +2,7 @@ import React from 'react';
import { useHistory } from 'react-router-dom';
import Icon from 'components/Icon';
import { Button, Classes, NavbarGroup, Intent } from '@blueprintjs/core';
import { FormattedMessage as T } from 'react-intl';
import { FormattedMessage as T } from 'components';
import { safeCallback } from 'utils';
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { FormattedMessage as T } from 'react-intl';
import { FormattedMessage as T } from 'components';
export default function ManualJournalDrawerFooter({
manualJournal: { amount_formatted },

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { FormattedMessage as T } from 'react-intl';
import { FormattedMessage as T } from 'components';
/**
* Manual journal details header.

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { Classes, Tooltip, Position } from '@blueprintjs/core';
import { formatMessage } from 'services/intl';
import intl from 'react-intl-universal';
import { DataTable, Money, If, Icon } from 'components';
import { isBlank } from 'utils';
@@ -32,17 +32,17 @@ export default function ManualJournalDrawerTable({
const columns = React.useMemo(
() => [
{
Header: formatMessage({ id: 'account_name' }),
Header: intl.get('account_name'),
accessor: 'account.name',
width: 130,
},
{
Header: formatMessage({ id: 'contact' }),
Header: intl.get('contact'),
accessor: 'contact.display_name',
width: 130,
},
{
Header: formatMessage({ id: 'credit' }),
Header: intl.get('credit'),
accessor: ({ credit }) =>
!isBlank(credit) && credit !== 0 ? (
<Money amount={credit} currency={currency_code} />
@@ -50,7 +50,7 @@ export default function ManualJournalDrawerTable({
width: 80,
},
{
Header: formatMessage({ id: 'debit' }),
Header: intl.get('debit'),
accessor: ({ debit }) =>
!isBlank(debit) && debit !== 0 ? (
<Money amount={debit} currency={currency_code} />
@@ -58,7 +58,7 @@ export default function ManualJournalDrawerTable({
width: 80,
},
{
Header: formatMessage({ id: 'note' }),
Header: intl.get('note'),
accessor: NoteAccessor,
width: 80,
},

View File

@@ -3,19 +3,19 @@ import PaperTemplateHeader from './PaperTemplateHeader';
import PaperTemplateTable from './PaperTemplateTable';
import PaperTemplateFooter from './PaperTemplateFooter';
import { updateItemsEntriesTotal } from 'containers/Entries/utils';
import { formatMessage } from 'services/intl';
import intl from 'react-intl-universal';
import 'style/components/Drawer/DrawerTemplate.scss';
function PaperTemplate({ labels: propLabels, paperData, entries }) {
const labels = {
name: formatMessage({ id: 'estimate_' }),
billedTo: formatMessage({ id: 'billed_to' }),
date: formatMessage({ id: 'estimate_date' }),
refNo: formatMessage({ id: 'estimate_no' }),
billedFrom: formatMessage({ id: 'billed_from' }),
amount: formatMessage({ id: 'estimate_amount' }),
dueDate: formatMessage({ id: 'due_date_' }),
name: intl.get('estimate_'),
billedTo: intl.get('billed_to'),
date: intl.get('estimate_date'),
refNo: intl.get('estimate_no'),
billedFrom: intl.get('billed_from'),
amount: intl.get('estimate_amount'),
dueDate: intl.get('due_date_'),
...propLabels,
};

View File

@@ -1,31 +1,31 @@
import React, { useMemo } from 'react';
import { formatMessage } from 'services/intl';
import intl from 'react-intl-universal';
import { DataTable, Money } from 'components';
export default function DrawerTemplateTable({ tableData, currencyCode }) {
const columns = useMemo(
() => [
{
Header: formatMessage({ id: 'description' }),
Header: intl.get('description'),
accessor: 'description',
disableSortBy: true,
width: 150,
},
{
Header: formatMessage({ id: 'rate' }),
Header: intl.get('rate'),
accessor: 'rate',
accessor: ({ rate }) => <Money amount={rate} currency={currencyCode} />,
disableSortBy: true,
width: 80,
},
{
Header: formatMessage({ id: 'qty' }),
Header: intl.get('qty'),
accessor: 'quantity',
disableSortBy: true,
width: 50,
},
{
Header: formatMessage({ id: 'Total' }),
Header: intl.get('Total'),
accessor: ({ total }) => (
<Money amount={total} currency={currencyCode} />
),

View File

@@ -1,7 +1,7 @@
import React from 'react';
import PaymentPaperTemplateHeader from './PaymentPaperTemplateHeader';
import PaymentPaperTemplateTable from './PaymentPaperTemplateTable';
import { formatMessage } from 'services/intl';
import intl from 'react-intl-universal';
import 'style/components/Drawer/DrawerTemplate.scss';
@@ -10,14 +10,14 @@ export default function PaymentPaperTemplate({
paperData,
}) {
const labels = {
name: formatMessage({ id: 'payment_receive' }),
billedTo: formatMessage({ id: 'billed_to' }),
date: formatMessage({ id: 'payment_date_' }),
refNo: formatMessage({ id: 'payment_no' }),
billedFrom: formatMessage({ id: 'billed_from' }),
referenceNo: formatMessage({ id: 'reference_no' }),
amount: formatMessage({ id: 'amount_received' }),
dueDate: formatMessage({ id: 'due_date_' }),
name: intl.get('payment_receive'),
billedTo: intl.get('billed_to'),
date: intl.get('payment_date_'),
refNo: intl.get('payment_no'),
billedFrom: intl.get('billed_from'),
referenceNo: intl.get('reference_no'),
amount: intl.get('amount_received'),
dueDate: intl.get('due_date_'),
...propLabels,
};
const defaultValues = {

View File

@@ -1,31 +1,31 @@
import React from 'react';
import moment from 'moment';
import { formatMessage } from 'services/intl';
import intl from 'react-intl-universal';
import { DataTable, Money } from 'components';
export default function PaymentPaperTemplateTable({ tableData, currencyCode }) {
const columns = React.useMemo(
() => [
{
Header: formatMessage({ id: 'invoice_number' }),
Header: intl.get('invoice_number'),
accessor: 'invoice.invoice_no',
disableSortBy: true,
},
{
Header: formatMessage({ id: 'invoice_date' }),
Header: intl.get('invoice_date'),
accessor: ({ invoice_date }) =>
moment(invoice_date).format('YYYY MMM DD'),
disableSortBy: true,
},
{
Header: formatMessage({ id: 'invoice_amount' }),
Header: intl.get('invoice_amount'),
accessor: ({ invoice }) => (
<Money amount={invoice.balance} currency={currencyCode} />
),
disableSortBy: true,
},
{
Header: formatMessage({ id: 'payment_amount' }),
Header: intl.get('payment_amount'),
accessor: ({ payment_amount }) => (
<Money amount={payment_amount} currency={currencyCode} />
),