Skip to content

Commit

Permalink
fix(FormattedMessages) id fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLeoB committed May 23, 2018
2 parents 6075d4d + 185aa99 commit ef6241e
Show file tree
Hide file tree
Showing 34 changed files with 616 additions and 202 deletions.
207 changes: 188 additions & 19 deletions packages/blockchain-wallet-v4-frontend/src/assets/locales/en.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'

import { actions, selectors } from 'data'
import Alerts from './template.js'

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ const selectStyle = status => {
const renderStatus = (status, isBuy) => {
switch (status) {
case 'awaiting_transfer_in':
case 'processing': return isBuy ? <FormattedMessage id='scenes.buysellorderhistory.list.orderstatus.processingbuy' defaultMessage='Pending Buy' /> : <FormattedMessage id='scenes.buysellorderhistory.list.orderstatus.processingsell' defaultMessage='Pending Sell' />

case 'completed': return isBuy ? <FormattedMessage id='scenes.buysellorderhistory.list.orderstatus.completedbuy' defaultMessage='Completed Buy' /> : <FormattedMessage id='scenes.buysellorderhistory.list.orderstatus.completedsell' defaultMessage='Completed Sell' />
case 'processing': return isBuy
? <FormattedMessage id='scenes.buysellorderhistory.list.orderstatus.processingbuy' defaultMessage='Pending Buy' />
: <FormattedMessage id='scenes.buysellorderhistory.list.orderstatus.processingsell' defaultMessage='Pending Sell' />
case 'completed': return isBuy
? <FormattedMessage id='scenes.buysellorderhistory.list.orderstatus.completedbuy' defaultMessage='Completed Buy' />
: <FormattedMessage id='scenes.buysellorderhistory.list.orderstatus.completedsell' defaultMessage='Completed Sell' />
case 'rejected': return <FormattedMessage id='scenes.buysellorderhistory.list.orderstatus.rejected' defaultMessage='Rejected' />
case 'failed': return <FormattedMessage id='scenes.buysellorderhistory.list.orderstatus.failed' defaultMessage='Failed' />
case 'cancelled': return <FormattedMessage id='scenes.buysellorderhistory.list.orderstatus.cancelled' defaultMessage='Cancelled' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const Confirmations = (props) => {
</Text>
) : (
<Text size='12px' weight={300} color='gray-3'>
<FormattedMessage id='scenes.transactions.content.pages.listitem.confirmation.unconfirmed' defaultMessage={`Pending: ${props.confirmations}/${props.minConfirmations} Confirmations`} />
<FormattedMessage id='scenes.transactions.content.pages.listitem.confirmation.unconfirmed' defaultMessage='Pending: {count}/{total} Confirmations' values={{ count: props.confirmations, total: props.minConfirmations }} />
</Text>
)}
<IconWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const Success = props => (
<Wrapper>
<Text size='12px' weight={300}>
{props.type === 'sent'
? <FormattedMessage id='components.transactionlistitem.fiatattime.valuewhensent' defaultMessage={`Value when sent: `} />
: <FormattedMessage id='components.transactionlistitem.fiatattime.valuewhenreceived' defaultMessage={`Value when received: `} />
? <FormattedMessage id='components.transactionlistitem.fiatattime.valuewhensent' defaultMessage='Value when sent: ' />
: <FormattedMessage id='components.transactionlistitem.fiatattime.valuewhenreceived' defaultMessage='Value when received: ' />
}
</Text>
<ValueWhenReceived
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,46 @@ import { Color } from 'blockchain-info-components'

const Announcements = [
{
title: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.title12' defaultMessage={'Import Funds from MyEtherWallet'} />,
desc: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.desc12' defaultMessage={'You can now import your ether from your MyEtherWallet backup directly into your Blockchain wallet.'} />,
title: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.title12' defaultMessage='Import Funds from MyEtherWallet' />,
desc: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.desc12' defaultMessage='You can now import your ether from your MyEtherWallet backup directly into your Blockchain wallet.' />,
date: 'February 10, 2018',
link: <NavLink to='/settings/info' style={{color: Color('brand-secondary')}}>
<FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.link.12' defaultMessage={'Learn More'} />
<FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.link.12' defaultMessage='Learn More' />
</NavLink>

}, {
title: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.title11' defaultMessage={'New Bitcoin Cash Address Format'} />,
desc: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.desc11' defaultMessage={'Bitcoin Cash addresses now follow the CashAddr format.'} />,
title: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.title11' defaultMessage='New Bitcoin Cash Address Format' />,
desc: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.desc11' defaultMessage='Bitcoin Cash addresses now follow the CashAddr format.' />,
date: 'January 18, 2018',
link: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.link.11' defaultMessage={'Learn More'} />
link: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.link.11' defaultMessage='Learn More' />

}, {
title: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.title10' defaultMessage={'Bitcoin Cash'} />,
desc: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.desc10' defaultMessage={'If you had bitcoin in your wallet before August 1, 2017, you can now access Bitcoin Cash via Settings > General.'} />,
title: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.title10' defaultMessage='Bitcoin Cash' />,
desc: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.desc10' defaultMessage='If you had bitcoin in your wallet before August 1, 2017, you can now access Bitcoin Cash via Settings > General.' />,
date: 'October 3, 2017',
link: <NavLink to='/bch/transactions' style={{color: Color('brand-secondary')}}>
<FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.link.12' defaultMessage={'Learn More'} />
<FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.link.12' defaultMessage='Learn More' />
</NavLink>
}, {
title: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.title9' defaultMessage={'Exchange Assets'} />,
desc: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.desc9' defaultMessage={'You can exchange between bitcoin, ether, and bitcoin cash directly from your Blockchain wallet'} />,
title: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.title9' defaultMessage='Exchange Assets' />,
desc: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.desc9' defaultMessage='You can exchange between bitcoin, ether, and bitcoin cash directly from your Blockchain wallet' />,
date: 'August 11, 2017',
link: <NavLink to='/exchange' style={{color: Color('brand-secondary')}}>
<FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.link.9' defaultMessage={'Learn More'} />
<FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.link.9' defaultMessage='Learn More' />
</NavLink>
}, {
title: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.title8' defaultMessage={'Send & Receive Ether'} />,
desc: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.desc8' defaultMessage={'You can now send and receive ether from your Blockchain wallet!'} />,
title: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.title8' defaultMessage='Send & Receive Ether' />,
desc: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.desc8' defaultMessage='You can now send and receive ether from your Blockchain wallet!' />,
date: 'July 24, 2017',
link: <NavLink to='/eth/transactions' style={{color: Color('brand-secondary')}}>
<FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.link.8' defaultMessage={'Learn More'} />
<FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.link.8' defaultMessage='Learn More' />
</NavLink>
}, {
title: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.title7' defaultMessage={'Sell Bitcoin'} />,
desc: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.desc7' defaultMessage={'You can now sell bitcoin directly from your Blockchain wallet!'} />,
title: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.title7' defaultMessage='Sell Bitcoin' />,
desc: <FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.desc7' defaultMessage='You can now sell bitcoin directly from your Blockchain wallet!' />,
date: 'May 12, 2017',
link: <NavLink to='/buy-sell' style={{color: Color('brand-secondary')}}>
<FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.link.7' defaultMessage={'Learn More'} />
<FormattedMessage id='layouts.wallet.header.whatsnew.whatsnew.link.7' defaultMessage='Learn More' />
</NavLink>
}
]
Expand Down
41 changes: 21 additions & 20 deletions packages/blockchain-wallet-v4-frontend/src/data/auth/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Either from 'data.either'
import * as actions from '../actions.js'
import * as actionTypes from '../actionTypes.js'
import * as selectors from '../selectors.js'
import * as C from 'services/AlertService'
import { askSecondPasswordEnhancer, promptForSecondPassword, forceSyncWallet } from 'services/SagaService'
import { Types } from 'blockchain-wallet-v4/src'

Expand All @@ -19,7 +20,7 @@ export default ({ api, coreSagas }) => {
yield put(actions.modals.closeModal())
} catch (e) {
yield put(actions.logs.logErrorMessage(logLocation, 'upgradeWallet', e))
yield put(actions.alerts.displayError('Failed to upgrade to HD and save wallet'))
yield put(actions.alerts.displayError(C.WALLET_UPGRADE_ERROR))
}
}

Expand All @@ -30,7 +31,7 @@ export default ({ api, coreSagas }) => {
yield put(actions.modals.showModal('Welcome', { walletMillions }))
} else {
yield put(actions.logs.logInfoMessage(logLocation, 'welcomeSaga', 'login success'))
yield put(actions.alerts.displaySuccess('Login successful'))
yield put(actions.alerts.displaySuccess(C.LOGIN_SUCCESS))
}
}

Expand Down Expand Up @@ -75,12 +76,12 @@ export default ({ api, coreSagas }) => {
yield fork(reportStats, mobileLogin)
yield fork(logoutRoutine, yield call(setLogoutEventListener))
if (!firstLogin) {
yield put(actions.alerts.displaySuccess('Login successful'))
yield put(actions.alerts.displaySuccess(C.LOGIN_SUCCESS))
}
} catch (e) {
yield put(actions.logs.logErrorMessage(logLocation, 'loginRoutineSaga', e))
// Redirect to error page instead of notification
yield put(actions.alerts.displayError('Critical error while fetching essential data! ' + e.message))
yield put(actions.alerts.displayError(C.WALLET_LOADING_ERROR))
}
}

Expand Down Expand Up @@ -124,7 +125,7 @@ export default ({ api, coreSagas }) => {

if (authRequired.isRight && authRequired.value) {
// auth errors (polling)
yield put(actions.alerts.displayInfo('Authorization required. Please check your mailbox.'))
yield put(actions.alerts.displayInfo(C.AUTHORIZATION_REQUIRED_INFO))
const authorized = yield call(pollingSession, session)
if (authorized) {
try {
Expand All @@ -133,15 +134,15 @@ export default ({ api, coreSagas }) => {
} catch (e) {
if (e.auth_type > 0) {
yield put(actions.auth.setAuthType(e.auth_type))
yield put(actions.alerts.displayInfo('2FA required'))
yield put(actions.alerts.displayInfo(C.TWOFA_REQUIRED_INFO))
yield put(actions.auth.loginFailure())
} else {
yield put(actions.auth.loginFailure('wrong_wallet_password'))
yield put(actions.logs.logErrorMessage(logLocation, 'login', e))
}
}
} else {
yield put(actions.alerts.displayError('Error establishing the session'))
yield put(actions.alerts.displayError(C.WALLET_SESSION_ERROR))
}
} else if (initialError.isRight && initialError.value) {
// general error
Expand All @@ -152,7 +153,7 @@ export default ({ api, coreSagas }) => {
// dispatch state change to show form
yield put(actions.auth.loginFailure())
yield put(actions.auth.setAuthType(error.auth_type))
yield put(actions.alerts.displayInfo('2FA required'))
yield put(actions.alerts.displayInfo(C.TWOFA_REQUIRED_INFO))
} else if (error.message) {
yield put(actions.auth.loginFailure(error.message))
} else {
Expand All @@ -170,9 +171,9 @@ export default ({ api, coreSagas }) => {
} catch (error) {
yield put(actions.logs.logErrorMessage(logLocation, 'mobileLogin', error))
if (error === 'qr_code_expired') {
yield put(actions.alerts.displayError('Error: QR code expired'))
yield put(actions.alerts.displayError(C.MOBILE_LOGIN_ERROR_QRCODE_EXPIRED))
} else {
yield put(actions.alerts.displayError('Error logging into your wallet'))
yield put(actions.alerts.displayError(C.MOBILE_LOGIN_ERROR))
}
}
yield put(actions.modals.closeModal())
Expand All @@ -181,40 +182,40 @@ export default ({ api, coreSagas }) => {
const register = function * (action) {
try {
yield put(actions.auth.registerLoading())
yield put(actions.alerts.displayInfo('Creating wallet...'))
yield put(actions.alerts.displayInfo(C.CREATE_WALLET_INFO))
yield call(coreSagas.wallet.createWalletSaga, action.payload)
yield put(actions.alerts.displaySuccess('Wallet successfully created.'))
yield put(actions.alerts.displaySuccess(C.REGISTER_SUCCESS))
yield call(loginRoutineSaga, false, true)
yield put(actions.auth.registerSuccess())
} catch (e) {
yield put(actions.auth.registerFailure(e))
yield put(actions.logs.logErrorMessage(logLocation, 'register', e))
yield put(actions.alerts.displayError('Wallet could not be created.'))
yield put(actions.alerts.displayError(C.REGISTER_ERROR))
}
}

const restore = function * (action) {
try {
yield put(actions.auth.restoreLoading())
yield put(actions.alerts.displayInfo('Restoring wallet...'))
yield put(actions.alerts.displayInfo(C.RESTORE_WALLET_INFO))
yield call(coreSagas.wallet.restoreWalletSaga, action.payload)
yield put(actions.alerts.displaySuccess('Your wallet has been successfully restored.'))
yield put(actions.alerts.displaySuccess(C.RESTORE_SUCCESS))
yield call(loginRoutineSaga, false, true)
yield put(actions.auth.restoreSuccess())
} catch (e) {
yield put(actions.auth.restoreFailure())
yield put(actions.logs.logErrorMessage(logLocation, 'restore', e))
yield put(actions.alerts.displayError('Error restoring your wallet.'))
yield put(actions.alerts.displayError(C.RESTORE_ERROR))
}
}

const remindGuid = function * (action) {
try {
yield call(coreSagas.wallet.remindWalletGuidSaga, action.payload)
yield put(actions.alerts.displaySuccess('Your wallet guid has been sent to your email address.'))
yield put(actions.alerts.displaySuccess(C.GUID_SENT_SUCCESS))
} catch (e) {
yield put(actions.logs.logErrorMessage(logLocation, 'remindGuid', e))
yield put(actions.alerts.displayError('Error sending email.'))
yield put(actions.alerts.displayError(C.GUID_SENT_ERROR))
}
}

Expand All @@ -224,7 +225,7 @@ export default ({ api, coreSagas }) => {
const response = yield call(coreSagas.wallet.resetWallet2fa, action.payload)
if (response.success) {
yield put(actions.auth.reset2faSuccess())
yield put(actions.alerts.displayInfo('Reset 2-step authentication has been successfully submitted.'))
yield put(actions.alerts.displayInfo(C.RESET_TWOFA_INFO))
} else {
yield put(actions.core.data.misc.fetchCaptcha())
yield put(actions.auth.reset2faFailure())
Expand All @@ -233,7 +234,7 @@ export default ({ api, coreSagas }) => {
} catch (e) {
yield put(actions.auth.reset2faFailure())
yield put(actions.logs.logErrorMessage(logLocation, 'reset2fa', e))
yield put(actions.alerts.displayError('Error resetting 2-step authentication.'))
yield put(actions.alerts.displayError(C.TWOFA_RESET_ERROR))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as A from './actions'
import * as S from './selectors'
import * as actions from '../../actions'
import * as selectors from '../../selectors'
import * as C from 'services/AlertService'
import { promptForSecondPassword } from 'services/SagaService'
import { getCoinFromPair, getPairFromCoin, getMinimum, getMaximum,
convertStandardToBase, isAmountBelowMinimum, isAmountAboveMaximum, calculateFinalAmount, selectFee,
Expand Down Expand Up @@ -267,7 +268,7 @@ export default ({ api, coreSagas }) => {
// We update the payment in the state
yield put(A.secondStepPaymentSent(paymentValue))
} catch (e) {
yield put(actions.alerts.displayError('The transaction failed to send. Please try again later.'))
yield put(actions.alerts.displayError(C.EXCHANGE_TRANSACTION_ERROR))
yield put(actions.logs.logErrorMessage(logLocation, 'secondStepSubmitClicked', e))
}
}
Expand Down Expand Up @@ -301,7 +302,7 @@ export default ({ api, coreSagas }) => {
}
} catch (e) {
yield put(actions.logs.logErrorMessage(logLocation, 'startPollingTradeStatus', e))
yield put(actions.alerts.displayError('Failed to refresh trade status.'))
yield put(actions.alerts.displayError(C.EXCHANGE_REFRESH_TRADE_ERROR))
} finally {
if (yield cancelled()) {
yield put(actions.logs.logInfoMessage(logLocation, 'startPollingTradeStatus', 'trade polling cancelled'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { cancel, call, fork, put, race, select, take } from 'redux-saga/effects'
import { delay } from 'redux-saga'
import { any, equals, identity, isNil, path, prop } from 'ramda'
import { actions, actionTypes, selectors } from 'data'
import * as C from 'services/AlertService'

export default ({ api, coreSagas }) => {
const logLocation = 'components/exchangeHistory/sagas'
Expand Down Expand Up @@ -44,13 +45,12 @@ export default ({ api, coreSagas }) => {
})
}
} catch (e) {
const orderId = path(['quote', 'orderId'], trade)
yield put(actions.alerts.displayError(`Could not fetch trade [${orderId}] status.`))
yield put(actions.alerts.displayError(C.EXCHANGE_REFRESH_TRADE_ERROR))
yield put(actions.logs.logErrorMessage(logLocation, 'exchangeHistoryInitialized', e))
}
}
} catch (e) {
yield put(actions.alerts.displayError(`Could not fetch all trades statuses.`))
yield put(actions.alerts.displayError(C.EXCHANGE_REFRESH_TRADES_ERROR))
yield put(actions.logs.logErrorMessage(logLocation, 'exchangeHistoryInitialized', e))
}
}
Expand All @@ -62,7 +62,7 @@ export default ({ api, coreSagas }) => {
yield call(delay, 5000)
}
} catch (e) {
yield put(actions.alerts.displayError('Unable to poll for trade status.'))
yield put(actions.alerts.displayError(C.EXCHANGE_REFRESH_TRADE_ERROR))
yield put(actions.logs.logErrorMessage(logLocation, 'startPollingTradeStatus', e))
}
}
Expand Down

0 comments on commit ef6241e

Please sign in to comment.