Browse Source

Translation for default account names

master
Thibaut Boustany 7 years ago
parent
commit
8a35752445
No known key found for this signature in database GPG Key ID: 32475B11A2B13EEC
  1. 28
      src/components/modals/AddAccounts/steps/03-step-import.js
  2. 3
      static/i18n/en/app.yml

28
src/components/modals/AddAccounts/steps/03-step-import.js

@ -28,6 +28,22 @@ class StepImport extends PureComponent<StepProps> {
scanSubscription = null scanSubscription = null
translateName(account: Account) {
const { t } = this.props
let { name } = account
if (name === 'New Account') {
name = t('app:addAccounts.newAccount')
} else if (name.indexOf('legacy') !== -1) {
name = t('app:addAccounts.legacyAccount', { accountName: name.replace(' (legacy)', '') })
}
return {
...account,
name,
}
}
startScanAccountsDevice() { startScanAccountsDevice() {
const { currency, currentDevice, setState } = this.props const { currency, currentDevice, setState } = this.props
try { try {
@ -49,7 +65,7 @@ class StepImport extends PureComponent<StepProps> {
const isNewAccount = account.operations.length === 0 const isNewAccount = account.operations.length === 0
if (!hasAlreadyBeenScanned) { if (!hasAlreadyBeenScanned) {
setState({ setState({
scannedAccounts: [...scannedAccounts, account], scannedAccounts: [...scannedAccounts, this.translateName(account)],
checkedAccountsIds: checkedAccountsIds:
!hasAlreadyBeenImported && !isNewAccount !hasAlreadyBeenImported && !isNewAccount
? uniq([...checkedAccountsIds, account.id]) ? uniq([...checkedAccountsIds, account.id])
@ -144,9 +160,7 @@ class StepImport extends PureComponent<StepProps> {
count: importableAccounts.length, count: importableAccounts.length,
}) })
const importableAccountsEmpty = `We didnt find any ${ const importableAccountsEmpty = t('app:addAccounts.noAccountToImport', { currencyName: currency ? ` ${currency.name}}` : ''})
currency ? ` ${currency.name}}` : ''
} account to import.`
return ( return (
<Fragment> <Fragment>
@ -163,10 +177,8 @@ class StepImport extends PureComponent<StepProps> {
isLoading={scanStatus === 'scanning'} isLoading={scanStatus === 'scanning'}
/> />
<AccountsList <AccountsList
title={t('app:addAccounts.createNewAccount')} title={t('app:addAccounts.createNewAccount.title')}
emptyText={ emptyText={t('app:addAccounts.createNewAccount.noOperationOnLastAccount')}
'You cannot create a new account because your last account has no operations'
}
accounts={creatableAccounts} accounts={creatableAccounts}
checkedIds={checkedAccountsIds} checkedIds={checkedAccountsIds}
onToggleAccount={this.handleToggleAccount} onToggleAccount={this.handleToggleAccount}

3
static/i18n/en/app.yml

@ -131,6 +131,9 @@ addAccounts:
selectAll: Select all selectAll: Select all
unselectAll: Unselect all unselectAll: Unselect all
editName: Edit name editName: Edit name
newAccount: New account
legacyAccount: '{{accountName}} (legacy)'
noAccountToImport: We didnt find any {{currencyName}}} account to import.
success: Great success! success: Great success!
createNewAccount: createNewAccount:
title: Create new account title: Create new account

Loading…
Cancel
Save