diff --git a/src/actions/account.js b/src/actions/account.js
index 566d67ae9..7049337b8 100644
--- a/src/actions/account.js
+++ b/src/actions/account.js
@@ -5,6 +5,7 @@ import { transactionAdded } from './transactions';
import { errorAlertDialogDisplayed } from './dialog';
import Fees from '../constants/fees';
import { toRawLsk } from '../utils/lsk';
+import transactionTypes from '../constants/transactionTypes';
/**
* Trigger this action to update the account object
@@ -58,7 +59,7 @@ export const secondPassphraseRegistered = ({ activePeer, secondPassphrase, accou
senderId: account.address,
amount: 0,
fee: Fees.setSecondPassphrase,
- type: 1,
+ type: transactionTypes.setSecondPassphrase,
}));
}).catch((error) => {
const text = (error && error.message) ? error.message : 'An error occurred while registering your second passphrase. Please try again.';
@@ -83,7 +84,7 @@ export const delegateRegistered = ({
username,
amount: 0,
fee: Fees.registerDelegate,
- type: 2,
+ type: transactionTypes.registerDelegate,
}));
})
.catch((error) => {
@@ -108,7 +109,7 @@ export const sent = ({ activePeer, account, recipientId, amount, passphrase, sec
recipientId,
amount: toRawLsk(amount),
fee: Fees.send,
- type: 0,
+ type: transactionTypes.send,
}));
})
.catch((error) => {
diff --git a/src/actions/account.test.js b/src/actions/account.test.js
index 6e0845187..70d62b258 100644
--- a/src/actions/account.test.js
+++ b/src/actions/account.test.js
@@ -9,6 +9,7 @@ import * as accountApi from '../utils/api/account';
import * as delegateApi from '../utils/api/delegate';
import Fees from '../constants/fees';
import { toRawLsk } from '../utils/lsk';
+import transactionTypes from '../constants/transactionTypes';
describe('actions: account', () => {
describe('accountUpdated', () => {
@@ -69,7 +70,7 @@ describe('actions: account', () => {
senderId: 'test_address',
amount: 0,
fee: Fees.setSecondPassphrase,
- type: 1,
+ type: transactionTypes.setSecondPassphrase,
};
actionFunction(dispatch);
@@ -129,7 +130,7 @@ describe('actions: account', () => {
username: data.username,
amount: 0,
fee: Fees.registerDelegate,
- type: 2,
+ type: transactionTypes.registerDelegate,
};
actionFunction(dispatch);
@@ -191,7 +192,7 @@ describe('actions: account', () => {
recipientId: data.recipientId,
amount: toRawLsk(data.amount),
fee: Fees.send,
- type: 0,
+ type: transactionTypes.send,
};
actionFunction(dispatch);
diff --git a/src/actions/dialog.js b/src/actions/dialog.js
index cc951babb..991b5a0da 100644
--- a/src/actions/dialog.js
+++ b/src/actions/dialog.js
@@ -1,5 +1,6 @@
-import actionTypes from '../constants/actions';
+import i18next from 'i18next';
import Alert from '../components/dialog/alert';
+import actionTypes from '../constants/actions';
/**
* An action to dispatch to display a dialog
@@ -28,7 +29,7 @@ export const alertDialogDisplayed = data => dialogDisplayed({
*
*/
export const successAlertDialogDisplayed = data => alertDialogDisplayed({
- title: 'Success',
+ title: i18next.t('Success'),
text: data.text,
type: 'success',
});
@@ -38,7 +39,7 @@ export const successAlertDialogDisplayed = data => alertDialogDisplayed({
*
*/
export const errorAlertDialogDisplayed = data => alertDialogDisplayed({
- title: 'Error',
+ title: i18next.t('Error'),
text: data.text,
type: 'error',
});
diff --git a/src/actions/voting.js b/src/actions/voting.js
index 434871b19..7dee77a66 100644
--- a/src/actions/voting.js
+++ b/src/actions/voting.js
@@ -4,6 +4,7 @@ import { errorAlertDialogDisplayed } from './dialog';
import { passphraseUsed } from './account';
import actionTypes from '../constants/actions';
import Fees from '../constants/fees';
+import transactionTypes from '../constants/transactionTypes';
/**
* Add pending variable to the list of voted delegates and list of unvoted delegates
@@ -82,7 +83,7 @@ export const votePlaced = ({ activePeer, passphrase, account, votes, secondSecre
senderId: account.address,
amount: 0,
fee: Fees.vote,
- type: 3,
+ type: transactionTypes.vote,
}));
}).catch((error) => {
const text = error && error.message ? `${error.message}.` : 'An error occurred while placing your vote.';
diff --git a/src/components/account/account.js b/src/components/account/account.js
index 24984024a..40bb821d0 100644
--- a/src/components/account/account.js
+++ b/src/components/account/account.js
@@ -63,7 +63,7 @@ const Account = ({
- Click to send all funds + {t('Click to send all funds')}
diff --git a/src/components/account/account.test.js b/src/components/account/account.test.js index 1e8b16e24..ac1215b47 100644 --- a/src/components/account/account.test.js +++ b/src/components/account/account.test.js @@ -1,7 +1,8 @@ import React from 'react'; import { expect } from 'chai'; -import sinon from 'sinon'; import { shallow } from 'enzyme'; +import sinon from 'sinon'; +import i18n from '../../i18n'; import store from '../../store'; import Account from './account'; import ClickToSend from '../clickToSend'; @@ -50,7 +51,7 @@ describe('Account', () => { it('should render balance with ClickToSend component', () => { const wrapper = shallow({props.text}
+{text}
- You need to become a delegate to start forging. - If you already registered to become a delegate, - your registration hasn't been processed, yet. + {t('You need to become a delegate to start forging. If you already registered to become a delegate, your registration hasn\'t been processed, yet.')}
: null } diff --git a/src/components/forging/forging.test.js b/src/components/forging/forging.test.js index e7ce164f3..3632df9d8 100644 --- a/src/components/forging/forging.test.js +++ b/src/components/forging/forging.test.js @@ -18,6 +18,7 @@ describe('Forging', () => { forgedBlocks: [], onForgingStatsUpdated: sinon.spy(), onForgedBlocksLoaded: sinon.spy(), + t: key => key, }; let account; diff --git a/src/components/forging/index.js b/src/components/forging/index.js index 9f799e467..598be0ea5 100644 --- a/src/components/forging/index.js +++ b/src/components/forging/index.js @@ -1,4 +1,5 @@ import { connect } from 'react-redux'; +import { translate } from 'react-i18next'; import { fetchAndUpdateForgedBlocks, fetchAndUpdateForgedStats } from '../../actions/forging'; import Forging from './forging'; @@ -17,4 +18,4 @@ const mapDispatchToProps = dispatch => ({ export default connect( mapStateToProps, mapDispatchToProps, -)(Forging); +)(translate()(Forging)); diff --git a/src/components/forging/index.test.js b/src/components/forging/index.test.js index d3176ef07..ee28023fb 100644 --- a/src/components/forging/index.test.js +++ b/src/components/forging/index.test.js @@ -1,8 +1,9 @@ import React from 'react'; import { expect } from 'chai'; import { mount } from 'enzyme'; -import { Provider } from 'react-redux'; import configureMockStore from 'redux-mock-store'; +import PropTypes from 'prop-types'; +import i18n from '../../i18n'; import ForgingHOC from './index'; describe('Forging HOC', () => { @@ -18,7 +19,14 @@ describe('Forging HOC', () => { forgedBlocks: [], }, }); - wrapper = mount(