Simplify i18n templates (#623)

* Start...

* Complete simplify i18n
This commit is contained in:
Jaco Greeff 2019-01-20 13:14:27 +01:00 committed by GitHub
parent 592c626428
commit 864171e00a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
77 changed files with 278 additions and 690 deletions

View File

@ -60,18 +60,14 @@ class Backup extends React.PureComponent<Props, State> {
<Button
isNegative
onClick={onClose}
text={t('backup.close', {
defaultValue: 'Cancel'
})}
text={t('Cancel')}
/>
<Button.Or />
<Button
isDisabled={!isPassValid}
isPrimary
onClick={this.doBackup}
text={t('backup.download', {
defaultValue: 'Download'
})}
text={t('Download')}
/>
</Button.Group>
</Modal.Actions>
@ -84,9 +80,7 @@ class Backup extends React.PureComponent<Props, State> {
return [
<Modal.Header key='header'>
{t('backup.header', {
defaultValue: 'Backup account'
})}
{t('Backup account')}
</Modal.Header>,
<Modal.Content
className='app--account-Backup-content'
@ -96,9 +90,7 @@ class Backup extends React.PureComponent<Props, State> {
<div className='ui--row'>
<Password
isError={!isPassValid}
label={t('backup.password', {
defaultValue: 'unlock account using the password'
})}
label={t('unlock account using the password')}
onChange={this.onChangePass}
tabIndex={0}
value={password}
@ -126,9 +118,7 @@ class Backup extends React.PureComponent<Props, State> {
status.account = pair.address();
status.status = blob ? 'success' : 'error';
status.message = t('status.backup', {
defaultValue: 'account backed up'
});
status.message = t('account backed up');
FileSaver.saveAs(blob, `${pair.address()}.json`);
} catch (error) {
@ -136,9 +126,7 @@ class Backup extends React.PureComponent<Props, State> {
console.error(error);
status.status = 'error';
status.message = t('status.error', {
defaultValue: error.message
});
status.message = error.message;
return;
}

View File

@ -63,18 +63,14 @@ class ChangePass extends React.PureComponent<Props, State> {
<Button
isNegative
onClick={onClose}
text={t('change.close', {
defaultValue: 'Cancel'
})}
text={t('Cancel')}
/>
<Button.Or />
<Button
isDisabled={!isNewValid || !isOldValid}
isPrimary
onClick={this.doChange}
text={t('change.change', {
defaultValue: 'Change'
})}
text={t('Change')}
/>
</Button.Group>
</Modal.Actions>
@ -87,9 +83,7 @@ class ChangePass extends React.PureComponent<Props, State> {
return [
<Modal.Header key='header'>
{t('change.header', {
defaultValue: 'Change account password'
})}
{t('Change account password')}
</Modal.Header>,
<Modal.Content key='content'>
<AddressSummary value={account.address()} />
@ -97,14 +91,14 @@ class ChangePass extends React.PureComponent<Props, State> {
<Password
autoFocus
isError={!isOldValid}
label={t('change.old', { defaultValue: 'old password' })}
label={t('old password')}
onChange={this.onChangeOld}
tabIndex={1}
value={oldPass}
/>
<Password
isError={!isNewValid}
label={t('change.new', { defaultValue: 'new password' })}
label={t('new password')}
onChange={this.onChangeNew}
tabIndex={2}
value={newPass}
@ -131,9 +125,7 @@ class ChangePass extends React.PureComponent<Props, State> {
} catch (error) {
this.setState({ isOldValid: false });
status.message = t('status.error', {
defaultValue: error.message
});
status.message = error.message;
return;
}
@ -143,9 +135,7 @@ class ChangePass extends React.PureComponent<Props, State> {
status.account = account.address();
status.status = 'success';
status.message = t('status.change-password', {
defaultValue: 'password changed'
});
status.message = t('password changed');
} catch (error) {
this.setState({ isNewValid: false });

View File

@ -88,8 +88,8 @@ class Creator extends React.PureComponent<Props, State> {
this.state = {
...this.emptyState(this.props.passthrough),
seedOptions: [
{ value: 'bip', text: t('seedType.bip', { defaultValue: 'Mnemonic' }) },
{ value: 'raw', text: t('seedType.raw', { defaultValue: 'Raw seed' }) }
{ value: 'bip', text: t('Mnemonic') },
{ value: 'raw', text: t('Raw seed') }
]
};
}
@ -123,18 +123,14 @@ class Creator extends React.PureComponent<Props, State> {
<Button.Group>
<Button
onClick={this.onDiscard}
text={t('creator.discard', {
defaultValue: 'Reset'
})}
text={t('Reset')}
/>
<Button.Or />
<Button
isDisabled={!isValid}
isPrimary
onClick={this.onShowWarning}
text={t('creator.save', {
defaultValue: 'Save'
})}
text={t('Save')}
/>
</Button.Group>
);
@ -151,9 +147,7 @@ class Creator extends React.PureComponent<Props, State> {
autoFocus
className='full'
isError={!isNameValid}
label={t('creator.name', {
defaultValue: 'name the account'
})}
label={t('name the account')}
onChange={this.onChangeName}
value={name}
/>
@ -166,19 +160,13 @@ class Creator extends React.PureComponent<Props, State> {
isError={!isSeedValid}
label={
seedType === 'bip'
? t('creator.seed.bip', {
defaultValue: 'create from the following mnemonic seed'
})
: t('creator.seed.raw', {
defaultValue: 'create from the following seed (hex or string)'
})
? t('create from the following mnemonic seed')
: t('create from the following seed (hex or string)')
}
onChange={this.onChangeSeed}
placeholder={
isBipBusy
? t('creator.seed.bipBusy', {
defaultValue: 'Generating Mnemeonic seed'
})
? t('Generating Mnemeonic seed')
: null
}
value={isBipBusy ? '' : seed}
@ -195,9 +183,7 @@ class Creator extends React.PureComponent<Props, State> {
<Password
className='full'
isError={!isPassValid}
label={t('creator.password', {
defaultValue: 'encrypt it using the password'
})}
label={t('encrypt it using the password')}
onChange={this.onChangePass}
value={password}
/>
@ -224,17 +210,13 @@ class Creator extends React.PureComponent<Props, State> {
<Button
isNegative
onClick={this.onHideWarning}
text={t('seedWarning.cancel', {
defaultValue: 'Cancel'
})}
text={t('Cancel')}
/>
<Button.Or />
<Button
isPrimary
onClick={this.onCommit}
text={t('seedWarning.continue', {
defaultValue: 'Create and backup account'
})}
text={t('Create and backup account')}
/>
</Button.Group>
</Modal.Actions>
@ -247,18 +229,12 @@ class Creator extends React.PureComponent<Props, State> {
return [
<Modal.Header key='header'>
{t('seedWarning.header', {
defaultValue: 'Important notice!'
})}
{t('sImportant notice!')}
</Modal.Header>,
<Modal.Content key='content'>
{t('seedWarning.content', {
defaultValue: 'We will provide you with a generated backup file after your account is created. As long as you have access to your account you can always redownload this file later.'
})}
{t('We will provide you with a generated backup file after your account is created. As long as you have access to your account you can always redownload this file later.')}
<Modal.Description>
{t('seedWarning.description', {
defaultValue: 'Please make sure to save this file in a secure location as it is the only way to restore your account.'
})}
{t('Please make sure to save this file in a secure location as it is the only way to restore your account.')}
</Modal.Description>
<AddressSummary
className='accounts--Modal-Address'
@ -379,14 +355,12 @@ class Creator extends React.PureComponent<Props, State> {
status.account = pair.address();
status.status = pair ? 'success' : 'error';
status.message = t('status.created', {
defaultValue: `created account`
});
status.message = t('created account');
InputAddress.setLastValue('account', pair.address());
} catch (err) {
} catch (error) {
status.status = 'error';
status.message = err.message;
status.message = error.message;
}
this.onHideWarning();

View File

@ -62,42 +62,32 @@ class Editor extends React.PureComponent<Props, State> {
<Button
isNegative
onClick={this.toggleForget}
text={t('editor.forget', {
defaultValue: 'Forget'
})}
text={t('Forget')}
/>
<Button.Group.Divider />
<Button
isDisabled={isEdited}
onClick={this.toggleBackup}
text={t('editor.backup', {
defaultValue: 'Backup'
})}
text={t('Backup')}
/>
<Button.Or />
<Button
isDisabled={isEdited}
onClick={this.togglePass}
text={t('editor.changePass', {
defaultValue: 'Change Password'
})}
text={t('Change Password')}
/>
<Button.Group.Divider />
<Button
isDisabled={!isEdited}
onClick={this.onDiscard}
text={t('editor.reset', {
defaultValue: 'Reset'
})}
text={t('Reset')}
/>
<Button.Or />
<Button
isDisabled={!isEdited}
isPrimary
onClick={this.onCommit}
text={t('editor.save', {
defaultValue: 'Save'
})}
text={t('Save')}
/>
</Button.Group>
);
@ -123,9 +113,7 @@ class Editor extends React.PureComponent<Props, State> {
className='full'
hideAddress
isInput={false}
label={t('editor.select', {
defaultValue: 'using my account'
})}
label={t('using my account')}
onChange={this.onChangeAccount}
type='account'
value={address}
@ -135,9 +123,7 @@ class Editor extends React.PureComponent<Props, State> {
<Input
className='full'
isEditable
label={t('editor.name', {
defaultValue: 'identified by the name'
})}
label={t('identified by the name')}
onChange={this.onChangeName}
value={editedName}
/>
@ -270,9 +256,7 @@ class Editor extends React.PureComponent<Props, State> {
});
status.status = current.getMeta().name === editedName ? 'success' : 'error';
status.message = t('status.editted', {
defaultValue: 'name edited'
});
status.message = t('name edited');
} catch (error) {
status.status = 'error';
status.message = error.message;
@ -349,12 +333,10 @@ class Editor extends React.PureComponent<Props, State> {
current.address()
);
status.status = 'success';
status.message = t('status.forgotten', {
defaultValue: 'account forgotten'
});
} catch (err) {
status.message = t('account forgotten');
} catch (error) {
status.status = 'error';
status.message = err.message;
status.message = error.message;
}
onStatusChange(status);

View File

@ -39,17 +39,13 @@ class Forgetting extends React.PureComponent<Props> {
<Button
isNegative
onClick={onClose}
text={t('forget.close', {
defaultValue: 'Cancel'
})}
text={t('Cancel')}
/>
<Button.Or />
<Button
isPrimary
onClick={doForget}
text={t('forget.forget', {
defaultValue: 'Forget'
})}
text={t('Forget')}
/>
</Button.Group>
</Modal.Actions>
@ -61,9 +57,7 @@ class Forgetting extends React.PureComponent<Props> {
return [
<Modal.Header key='header'>
{t('forget.header', {
defaultValue: 'Confirm account removal'
})}
{t('Confirm account removal')}
</Modal.Header>,
<Modal.Content key='content'>
<AddressSummary value={address} />

View File

@ -62,9 +62,7 @@ class Restore extends React.PureComponent<Props, State> {
isDisabled={!isFileValid || !isPassValid}
isPrimary
onClick={this.onSave}
text={t('restore.save', {
defaultValue: 'Restore'
})}
text={t('Restore')}
/>
</Button.Group>
</div>
@ -74,35 +72,30 @@ class Restore extends React.PureComponent<Props, State> {
private renderInput () {
const { t } = this.props;
const { isFileValid, isPassValid, password } = this.state;
const acceptedFormats = ['application/json', 'text/plain'].join(', ');
return (
<div className='grow'>
<div className='ui--row'>
<Password
autoFocus
className='full'
isError={!isPassValid}
label={t('restore.password', {
defaultValue: 'decrypt keyfile using the password'
})}
onChange={this.onChangePass}
value={password}
/>
</div>
<div className='ui--row'>
<InputFile
accept={acceptedFormats}
className='full'
isError={!isFileValid}
label={t('restore.json', {
defaultValue: 'previously backed-up json keyfile'
})}
label={t('previously backed-up json keyfile')}
onChange={this.onChangeFile}
withLabel
/>
</div>
<div className='ui--row'>
<Password
autoFocus
className='full'
isError={!isPassValid}
label={t('decrypt keyfile using the password')}
onChange={this.onChangePass}
value={password}
/>
</div>
</div>
);
}
@ -152,9 +145,7 @@ class Restore extends React.PureComponent<Props, State> {
status.status = pair ? 'success' : 'error';
status.account = pair.address();
status.message = t('status.restored', {
defaultValue: 'account restored'
});
status.message = t('account restored');
InputAddress.setLastValue('account', pair.address());
onRestoreAccount();

View File

@ -81,8 +81,8 @@ class VanityApp extends React.PureComponent<Props, State> {
onClick={this.toggleStart}
text={
isRunning
? t('vanity.stop', { defaultValue: 'Stop generation' })
: t('vanity.start', { defaultValue: 'Start generation' })
? t('Stop generation')
: t('Start generation')
}
/>
</Button.Group>
@ -118,30 +118,22 @@ class VanityApp extends React.PureComponent<Props, State> {
className='medium'
isDisabled={isRunning}
isError={!isMatchValid}
label={t('vanity.matching', {
defaultValue: 'generate address containing (? wildcard)'
})}
label={t('generate address containing (? wildcard)')}
onChange={this.onChangeMatch}
value={match}
/>
<Dropdown
className='small'
isDisabled={isRunning}
label={t('vanity.case', {
defaultValue: 'case sensitive match'
})}
label={t('case sensitive match')}
options={BOOL_OPTIONS}
onChange={this.onChangeCase}
value={withCase}
/>
<Static
className='small'
label={t('vanity.offset', {
defaultValue: 'exact offset'
})}
value={t('vanity.offset.off', {
defaultValue: 'No'
})}
label={t('exact offset')}
value={t('No')}
/>
</div>
);
@ -159,8 +151,7 @@ class VanityApp extends React.PureComponent<Props, State> {
return (
<div className='vanity--App-stats'>
{t('vanity.stats', {
defaultValue: 'Evaluated {{count}} keys in {{elapsed}}s ({{avg}} keys/s)',
{t('Evaluated {{count}} keys in {{elapsed}}s ({{avg}} keys/s)', {
replace: {
avg: (keyCount / secs).toFixed(3),
count: keyCount,

View File

@ -55,19 +55,19 @@ class AccountsApp extends React.PureComponent<Props, State> {
items: [
{
name: 'edit',
text: t('app.edit', { defaultValue: 'Edit account' })
text: t('Edit account')
},
{
name: 'create',
text: t('app.create', { defaultValue: 'Create account' })
text: t('Create account')
},
{
name: 'restore',
text: t('app.restore', { defaultValue: 'Restore account' })
text: t('Restore account')
},
{
name: 'vanity',
text: t('app.vanity', { defaultValue: 'Vanity address' })
text: t('Vanity address')
}
]
};

View File

@ -61,18 +61,14 @@ class Creator extends React.PureComponent<Props, State> {
<Button.Group>
<Button
onClick={this.onDiscard}
text={t('creator.discard', {
defaultValue: 'Reset'
})}
text={t('Reset')}
/>
<Button.Or />
<Button
isDisabled={!isValid}
isPrimary
onClick={this.onCommit}
text={t('creator.save', {
defaultValue: 'Save'
})}
text={t('Save')}
/>
</Button.Group>
);
@ -89,9 +85,7 @@ class Creator extends React.PureComponent<Props, State> {
autoFocus
className='full'
isError={!isAddressValid}
label={t('creator.address', {
defaultValue: 'add the following address'
})}
label={t('add the following address')}
onChange={this.onChangeAddress}
value={address}
/>
@ -100,9 +94,7 @@ class Creator extends React.PureComponent<Props, State> {
<Input
className='full'
isError={!isNameValid}
label={t('creator.name', {
defaultValue: 'name the entry'
})}
label={t('name the entry')}
onChange={this.onChangeName}
value={name}
/>
@ -189,19 +181,13 @@ class Creator extends React.PureComponent<Props, State> {
status.account = address;
status.status = address ? 'success' : 'error';
status.message = isAddressExisting
? t('status.edited', {
defaultValue: 'address edited'
})
: t('status.created', {
defaultValue: 'address created'
});
? t('address edited')
: t('address created');
InputAddress.setLastValue('address', address);
} catch (err) {
} catch (error) {
status.status = 'error';
status.message = t('status.error', {
defaultValue: err.message
});
status.message = error.message;
}
onCreateAddress();

View File

@ -62,26 +62,20 @@ class Editor extends React.PureComponent<Props, State> {
<Button
isNegative
onClick={this.toggleForget}
text={t('editor.forget', {
defaultValue: 'Forget'
})}
text={t('Forget')}
/>
<Button.Group.Divider />
<Button
isDisabled={!isEdited}
onClick={this.onDiscard}
text={t('editor.reset', {
defaultValue: 'Reset'
})}
text={t('Reset')}
/>
<Button.Or />
<Button
isDisabled={!isEdited}
isPrimary
onClick={this.onCommit}
text={t('editor.save', {
defaultValue: 'Save'
})}
text={t('Save')}
/>
</Button.Group>
);
@ -107,9 +101,7 @@ class Editor extends React.PureComponent<Props, State> {
className='full'
hideAddress
isInput={false}
label={t('editor.select', {
defaultValue: 'edit the selected address'
})}
label={t('edit the selected address')}
onChange={this.onChangeAddress}
type='address'
value={address}
@ -118,9 +110,7 @@ class Editor extends React.PureComponent<Props, State> {
<div className='ui--row'>
<Input
className='full'
label={t('editor.name', {
defaultValue: 'identified by the name'
})}
label={t('identified by the name')}
onChange={this.onChangeName}
value={editedName}
/>
@ -203,14 +193,10 @@ class Editor extends React.PureComponent<Props, State> {
});
status.status = current.getMeta().name === editedName ? 'success' : 'error';
status.message = t('status.editted', {
defaultValue: 'name edited'
});
} catch (e) {
status.message = t('name edited');
} catch (error) {
status.status = 'error';
status.message = t('status.error', {
defaultValue: e.message
});
status.message = error.message;
}
onStatusChange(status);
@ -257,14 +243,10 @@ class Editor extends React.PureComponent<Props, State> {
current.address()
);
status.status = 'success';
status.message = t('status.forgotten', {
defaultValue: 'address forgotten'
});
} catch (err) {
status.message = t('address forgotten');
} catch (error) {
status.status = 'error';
status.message = t('status.error', {
defaultValue: err.message
});
status.message = error.message;
}
onStatusChange(status);

View File

@ -51,17 +51,13 @@ class Forgetting extends React.PureComponent<Props> {
<Button
isNegative
onClick={onClose}
text={t('forget.close', {
defaultValue: 'Cancel'
})}
text={t('Cancel')}
/>
<Button.Or />
<Button
isPrimary
onClick={doForget}
text={t('forget.forget', {
defaultValue: 'Forget'
})}
text={t('Forget')}
/>
</Button.Group>
</Modal.Actions>
@ -77,9 +73,7 @@ class Forgetting extends React.PureComponent<Props> {
return [
<Modal.Header key='header'>
{t('forget.header', {
defaultValue: 'Confirm address removal'
})}
{t('Confirm address removal')}
</Modal.Header>,
<Modal.Content className='forgetting-Address' key='content'>
<AddressSummary

View File

@ -50,11 +50,11 @@ class AddressesApp extends React.PureComponent<Props, State> {
items: [
{
name: 'edit',
text: t('app.edit', { defaultValue: 'Edit address' })
text: t('Edit address')
},
{
name: 'create',
text: t('app.create', { defaultValue: 'Add address' })
text: t('Add address')
}
]
};

View File

@ -46,11 +46,7 @@ class ProposalDisplay extends React.PureComponent<Props> {
return (
<div className='democracy--Proposal-info'>
<Labelled
label={t('proposal.depositsAddresses', {
defaultValue: 'depositors'
})}
>
<Labelled label={t('depositors')}>
<div>
{addresses.map((address) => (
<AddressMini
@ -61,11 +57,7 @@ class ProposalDisplay extends React.PureComponent<Props> {
))}
</div>
</Labelled>
<Static
label={t('proposal.depositsBalanceLabel', {
defaultValue: 'balance'
})}
>
<Static label={t('balance')}>
{balanceFormat(balance)}
</Static>
</div>

View File

@ -21,9 +21,7 @@ class Proposals extends React.PureComponent<Props> {
return (
<section className='democracy--Proposals'>
<h1>{t('proposals.header', {
defaultValue: 'proposals'
})}</h1>
<h1>{t('proposals')}</h1>
{this.renderProposals()}
</section>
);
@ -35,9 +33,7 @@ class Proposals extends React.PureComponent<Props> {
if (!democracy_publicProps || !democracy_publicProps.length) {
return (
<div className='ui disabled'>
{t('proposals.none', {
defaultValue: 'no available proposals'
})}
{t('no available proposals')}
</div>
);
}

View File

@ -123,26 +123,16 @@ class Referendum extends React.PureComponent<Props, State> {
return (
<div className='democracy--Referendum-info'>
<Static
label={t('referendum.endLabel', {
defaultValue: 'ending at'
})}
>
{t('referendum.endInfo', {
defaultValue: 'block #{{blockNumber}}, {{remaining}} blocks remaining',
<Static label={t('ending at')}>
{t('block #{{blockNumber}}, {{remaining}} blocks remaining', {
replace: {
blockNumber: numberFormat(end),
remaining: numberFormat(end.sub(chain_bestNumber).subn(1))
}
})}
</Static>
<Static
label={t('referendum.enactLabel', {
defaultValue: 'activate at (if passed)'
})}
>
{t('referendum.enactInfo', {
defaultValue: 'block #{{blockNumber}}',
<Static label={t('activate at (if passed)')}>
{t('block #{{blockNumber}}', {
replace: {
blockNumber: numberFormat(enactBlock)
}
@ -151,11 +141,12 @@ class Referendum extends React.PureComponent<Props, State> {
<VoteThreshold
isDisabled
defaultValue={{ value: threshold } as RawParam}
label={t('referendum.thresholdLabel', {
defaultValue: 'vote threshold'
})}
label={t('vote threshold')}
name='voteThreshold'
type={{ info: 0, type: 'VoteThreshold' }}
type={{
info: 0,
type: 'VoteThreshold'
}}
/>
</div>
);

View File

@ -24,9 +24,7 @@ class Referendums extends React.PureComponent<Props> {
return (
<section className='democracy--Referendums'>
<h1>{t('referendums.header', {
defaultValue: 'referendums'
})}</h1>
<h1>{t('referendums')}</h1>
{this.renderReferendums()}
</section>
);
@ -39,9 +37,7 @@ class Referendums extends React.PureComponent<Props> {
if (!democracy_referendums || !democracy_referendums.length || (referendumCount === (democracy_nextTally || new BN(0)).toNumber())) {
return (
<div className='ui disabled'>
{t('proposals.none', {
defaultValue: 'no available referendums'
})}
{t('no available referendums')}
</div>
);
}

View File

@ -24,49 +24,33 @@ type Props = I18nProps & {
class Summary extends React.PureComponent<Props> {
render () {
const { chain_bestNumber = new BN(0), democracy_launchPeriod, democracy_nextTally, democracy_publicPropCount, democracy_referendumCount, democracy_votingPeriod, t } = this.props;
const { chain_bestNumber = new BN(0), democracy_launchPeriod = new BN(1), democracy_nextTally = new BN(0), democracy_publicPropCount, democracy_referendumCount = new BN(0), democracy_votingPeriod = new BN(1), t } = this.props;
return (
<summary>
<section>
<CardSummary
label={t('summary.proposalCount', {
defaultValue: 'proposals'
})}
>
<CardSummary label={t('proposals')}>
{numberFormat(democracy_publicPropCount)}
</CardSummary>
<CardSummary
label={t('summary.referendumCount', {
defaultValue: 'referendums'
})}
>
<CardSummary label={t('referendums')}>
{numberFormat(democracy_referendumCount)}
</CardSummary>
<CardSummary
label={t('summary.active', {
defaultValue: 'active num'
})}
>
{numberFormat((democracy_referendumCount || new BN(0)).sub(democracy_nextTally || new BN(0)))}
<CardSummary label={t('active')}>
{numberFormat(democracy_referendumCount.sub(democracy_nextTally))}
</CardSummary>
</section>
<section>
<CardSummary
label={t('summary.votingPeriod', {
defaultValue: 'voting period'
})}
label={t('voting period')}
progress={{
value: chain_bestNumber.mod(democracy_votingPeriod || new BN(1)).addn(1),
total: democracy_votingPeriod || new BN(1)
value: chain_bestNumber.mod(democracy_votingPeriod).addn(1),
total: democracy_votingPeriod
}}
/>
<CardSummary
label={t('summary.launchPeriod', {
defaultValue: 'launch period'
})}
label={t('launch period')}
progress={{
value: chain_bestNumber.mod(democracy_launchPeriod || new BN(1)).addn(1),
value: chain_bestNumber.mod(democracy_launchPeriod).addn(1),
total: democracy_launchPeriod || new BN(1)
}}
/>

View File

@ -30,9 +30,7 @@ class Voting extends React.PureComponent<Props, State> {
return (
<div className='democracy--Referendum-vote'>
<InputAddress
label={t('voting.account', {
defaultValue: 'vote using my account'
})}
label={t('vote using my account')}
onChange={this.onChangeAccount}
placeholder='0x...'
type='account'

View File

@ -28,18 +28,14 @@ class VotingButton extends React.PureComponent<Props> {
<Button
isDisabled={!accountId}
isNegative
text={t('votebtn.nay', {
defaultValue: 'Nay'
})}
text={t('Nay')}
onClick={this.onClickNo}
/>
<Button.Or />
<Button
isDisabled={!accountId}
isPositive
text={t('votebtn.aye', {
defaultValue: 'Aye'
})}
text={t('Aye')}
onClick={this.onClickYes}
/>
</Button.Group>

View File

@ -24,9 +24,7 @@ class Events extends React.PureComponent<Props> {
return (
<section>
<h1>{t('block.events', {
defaultValue: 'events'
})}</h1>
<h1>{t('events')}</h1>
<div className='explorer--BlockByHash-flexable'>
<EventsDisplay
eventClassName='explorer--BlockByHash-block'

View File

@ -25,9 +25,7 @@ class Logs extends React.PureComponent<Props> {
return (
<section>
<h1>{t('block.logs', {
defaultValue: 'logs'
})}</h1>
<h1>{t('logs')}</h1>
<div className='explorer--BlockByHash-flexable'>
{value.map(this.renderItem)}
</div>

View File

@ -26,8 +26,7 @@ class Extrinsics extends React.PureComponent<Props> {
<tr>
<td className='type'>extrinsics</td>
<td className='hash'>
{t('extrinsics.count', {
defaultValue: '{{count}} in block',
{t('{{count}} in block', {
replace: {
count: chain_getBlock.extrinsics.length
}

View File

@ -23,9 +23,7 @@ class Events extends React.PureComponent<Props> {
const { emptyLabel, eventClassName, value, t } = this.props;
if (!value || value.length === 0) {
return emptyLabel || t('events.none', {
defaultValue: 'no events available'
});
return emptyLabel || t('no events available');
}
return value
@ -59,7 +57,11 @@ class Events extends React.PureComponent<Props> {
>
<div className='header'>
<h3>
{extIndex === -1 ? '' : `#${numberFormat(extIndex)}: `}{event.section}.{event.method}
{
extIndex !== -1
? `#${numberFormat(extIndex)}: `
: ''
}{event.section}.{event.method}
</h3>
<div className='description'>
{

View File

@ -58,9 +58,7 @@ class EventsRecent extends React.PureComponent<Props, State> {
return (
<div>
<Events
emptyLabel={t('events.system-none', {
defaultValue: 'no recent non-system events available'
})}
emptyLabel={t('no recent non-system events available')}
value={recentEvents}
withoutIndex
/>

View File

@ -26,15 +26,11 @@ class Main extends React.PureComponent<Props> {
key='overview'
>
<div className='column'>
<h1>{t('main.recentBlocks', {
defaultValue: 'recent blocks'
})}</h1>
<h1>{t('recent blocks')}</h1>
<BlockHeaders />
</div>
<div className='column'>
<h1>{t('main.recentEvents', {
defaultValue: 'recent events'
})}</h1>
<h1>{t('recent events')}</h1>
<EventsRecent />
</div>
</div>

View File

@ -35,9 +35,7 @@ class Query extends React.PureComponent<Props, State> {
<Input
className='storage--Query-actionrow-hash'
isError={!isValid && hash.length !== 0}
placeholder={t('query', {
defaultValue: 'block hash to query'
})}
placeholder={t('block hash to query')}
onChange={this.setHash}
/>
<Labelled className='storage--Query-actionrow-button'>

View File

@ -23,18 +23,10 @@ class Summary extends React.PureComponent<Props> {
style={style}
>
<section>
<CardSummary
label={t('summary.period', {
defaultValue: 'target time'
})}
>
<CardSummary label={t('target time')}>
<TimePeriod />
</CardSummary>
<CardSummary
label={t('summary.now', {
defaultValue: 'last block'
})}
>
<CardSummary label={t('last block')}>
<TimeNow />
</CardSummary>
</section>
@ -42,18 +34,10 @@ class Summary extends React.PureComponent<Props> {
<SummarySession />
</section>
<section>
<CardSummary
label={t('summary.finalised', {
defaultValue: 'finalised'
})}
>
<CardSummary label={t('finalised')}>
<BestFinalised />
</CardSummary>
<CardSummary
label={t('summary.best', {
defaultValue: 'best'
})}
>
<CardSummary label={t('best')}>
<BestNumber />
</CardSummary>
</section>

View File

@ -45,9 +45,7 @@ class SummarySession extends React.PureComponent<Props> {
// return (
// <CardSummary
// key='brokenCount'
// label={t('summary.brokenCount', {
// defaultValue: 'lateness'
// })}
// label={t('lateness')}
// progress={{
// color: 'autoReverse',
// isPercent: true,
@ -68,9 +66,7 @@ class SummarySession extends React.PureComponent<Props> {
return (
<CardSummary
key='eraProgress'
label={t('summary.eraProgress', {
defaultValue: 'era'
})}
label={t('era')}
progress={{
total: session_eraLength,
value: session_eraProgress
@ -80,7 +76,7 @@ class SummarySession extends React.PureComponent<Props> {
}
private renderSession () {
const { session_sessionProgress, session_sessionLength, t, withSession = true } = this.props;
const { session_sessionProgress, session_sessionLength = new BN(0), t, withSession = true } = this.props;
if (!withSession) {
return null;
@ -89,11 +85,9 @@ class SummarySession extends React.PureComponent<Props> {
return (
<CardSummary
key='sessionProgress'
label={t('summary.sessionProgress', {
defaultValue: 'session'
})}
label={t('session')}
progress={{
total: session_sessionLength || new BN(0),
total: session_sessionLength,
value: session_sessionProgress
}}
/>

View File

@ -71,9 +71,7 @@ class Account extends React.PureComponent<Props, State> {
return (
<Labelled
className='small'
label={t('account.balance', {
defaultValue: 'with an available balance of'
})}
label={t('with an available balance of')}
withLabel={withLabel}
>
<Balance

View File

@ -33,14 +33,12 @@ class ExtrinsicDisplay extends React.PureComponent<Props> {
isDisabled={isDisabled}
isError={isError}
isPrivate={isPrivate}
labelMethod={t('proposal.method', {
defaultValue: '{{label}} (extrinsic)',
labelMethod={t('{{label}} (extrinsic)', {
replace: {
label
}
})}
labelSection={t('proposal.section', {
defaultValue: '{{label}} (section)',
labelSection={t('{{label}} (section)', {
replace: {
label
}

View File

@ -48,23 +48,17 @@ class Selection extends React.PureComponent<Props, State> {
<div className='extrinsics--Selection'>
<Account
isInput={false}
label={t('display.sender', {
defaultValue: 'using the selected account'
})}
label={t('using the selected account')}
onChange={this.onChangeSender}
type='account'
/>
<ExtrinsicDisplay
defaultValue={defaultExtrinsic}
labelMethod={t('display.method', {
defaultValue: 'submit the following extrinsic'
})}
labelMethod={t('submit the following extrinsic')}
onChange={this.onChangeExtrinsic}
/>
<Nonce
label={t('display.nonce', {
defaultValue: 'with an index'
})}
label={t('with an index')}
callOnResult={this.onChangeNonce}
value={accountId}
/>
@ -72,18 +66,14 @@ class Selection extends React.PureComponent<Props, State> {
<Button
isDisabled={!isValid}
onClick={this.onQueueInherent}
text={t('submit.label', {
defaultValue: 'Submit Inherent'
})}
text={t('Submit Inherent')}
/>
<Button.Or />
<Button
isDisabled={!isValid}
isPrimary
onClick={this.onQueueExtrinsic}
text={t('submit.label', {
defaultValue: 'Submit Transaction'
})}
text={t('Submit Transaction')}
/>
</Button.Group>
</div>

View File

@ -28,11 +28,9 @@ class ExtrinsicsApp extends React.PureComponent<Props> {
if (!accountAll || !Object.keys(accountAll).length) {
return (
<main className='extrinsics--App'>
{t('accounts.none', {
defaultValue: 'There are no saved accounts. '
})}
{t('There are no saved accounts. ')}
<Link to='/accounts'>
Add Accounts.
{t('Add Accounts.')}
</Link>
</main>
);

View File

@ -30,7 +30,11 @@ class Peers extends React.PureComponent<Props> {
const { peers, t } = this.props;
if (!peers || !peers.length) {
return t('no peers connected');
return (
<div className='ui disabled'>
{t('no peers connected')}
</div>
);
}
return (

View File

@ -33,7 +33,11 @@ class Pending extends React.PureComponent<Props> {
const { extrinsics, t } = this.props;
if (!extrinsics || !extrinsics.length) {
return t('no pending extrinsics are in the queue');
return (
<div className='ui disabled'>
{t('no pending extrinsics are in the queue')}
</div>
);
}
return (

View File

@ -43,9 +43,7 @@ class Account extends React.PureComponent<Props, State> {
<InputAddress
defaultValue={defaultValue}
isError={isError}
label={t('account.address', {
defaultValue: 'sign data from account'
})}
label={t('sign data from account')}
onChange={this.onChangeAccount}
placeholder='0x...'
type='account'
@ -67,9 +65,7 @@ class Account extends React.PureComponent<Props, State> {
return (
<Labelled
className='small'
label={t('account.nonce', {
defaultValue: 'with an index of'
})}
label={t('with an index of')}
>
<Nonce
className='ui disabled dropdown selection'

View File

@ -63,9 +63,7 @@ class Selection extends React.PureComponent<Props, State> {
isDisabled={!isValid}
isPrimary
onClick={this.onSubmit}
text={t('submit', {
defaultValue: 'Submit RPC call'
})}
text={t('Submit RPC call')}
/>
</Button.Group>
</section>

View File

@ -47,16 +47,12 @@ class App extends React.PureComponent<Props, State> {
return (
<main className='settings--App'>
<section>
<h1>{t('settings.general', {
defaultValue: 'general'
})}</h1>
<h1>{t('general')}</h1>
<div className='ui--row'>
<div className='full'>
<Dropdown
defaultValue={apiUrl}
label={t('select.api.url', {
defaultValue: 'remote node/endpoint to connect to'
})}
label={t('remote node/endpoint to connect to')}
onChange={this.onChangeApiUrl}
options={settings.availableNodes}
/>
@ -66,9 +62,7 @@ class App extends React.PureComponent<Props, State> {
<div className='medium'>
<Dropdown
defaultValue={uiTheme}
label={t('select.ui.theme', {
defaultValue: 'default interface theme'
})}
label={t('default interface theme')}
onChange={this.onChangeUiTheme}
options={settings.availableUIThemes}
/>
@ -76,9 +70,7 @@ class App extends React.PureComponent<Props, State> {
<div className='medium'>
<Dropdown
defaultValue={uiMode}
label={t('select.ui.mode', {
defaultValue: 'interface operation mode'
})}
label={t('interface operation mode')}
onChange={this.onChangeUiMode}
options={settings.availableUIModes}
/>
@ -89,9 +81,7 @@ class App extends React.PureComponent<Props, State> {
<Dropdown
defaultValue={i18nLang}
isDisabled
label={t('select.i18n.lang', {
defaultValue: 'default interface language'
})}
label={t('default interface language')}
onChange={this.onChangeLang}
options={settings.availableLanguages}
/>
@ -99,14 +89,12 @@ class App extends React.PureComponent<Props, State> {
</div>
</section>
<section>
<h1>{t('settings.developer', {
defaultValue: 'developer'
})}</h1>
<h1>{t('developer')}</h1>
<div className='ui--row'>
<div className='full'>
<InputFile
isError={typesError}
label='additional type definitions (JSON)'
label={t('additional type definitions (JSON)')}
onChange={this.onChangeTypes}
placeholder={typesPlaceholder}
/>
@ -117,9 +105,7 @@ class App extends React.PureComponent<Props, State> {
<Button
isPrimary
onClick={this.save}
text={t('btn.do', {
defaultValue: 'Save & Reload'
})}
text={t('Save & Reload')}
/>
</Button.Group>
</main>

View File

@ -38,14 +38,13 @@ class CurrentList extends React.PureComponent<Props> {
return [
<h1 key='header'>
{t('list.current', {
defaultValue: 'validators',
{t('validators', {
replace: {
count: current.length
}
})}
</h1>,
this.renderColumn(current, t('name.validator', { defaultValue: 'validator' }))
this.renderColumn(current, t('validator'))
];
}
@ -53,12 +52,8 @@ class CurrentList extends React.PureComponent<Props> {
const { next, t } = this.props;
return [
<h1 key='header'>
{t('list.next', {
defaultValue: 'next up'
})}
</h1>,
this.renderColumn(next, t('name.intention', { defaultValue: 'intention' }))
<h1 key='header'>{t('next up')}</h1>,
this.renderColumn(next, t('intention'))
];
}
@ -77,9 +72,7 @@ class CurrentList extends React.PureComponent<Props> {
if (addresses.length === 0) {
return (
<div key='none'>{t('list.empty', {
defaultValue: 'no addresses found'
})}</div>
<div key='none'>{t('no addresses found')}</div>
);
}

View File

@ -32,18 +32,10 @@ class Summary extends React.PureComponent<Props> {
style={style}
>
<section>
<CardSummary
label={t('summary.validators', {
defaultValue: 'validators'
})}
>
<CardSummary label={t('validators')}>
{validators.length}/{staking_validatorCount ? staking_validatorCount.toString() : '-'}
</CardSummary>
<CardSummary
label={t('summary.intentions', {
defaultValue: 'intentions'
})}
>
<CardSummary label={t('intentions')}>
{intentions.length}
</CardSummary>
</section>
@ -51,11 +43,7 @@ class Summary extends React.PureComponent<Props> {
<SummarySession withBroken={false} />
</section>
<section>
<CardSummary
label={t('summary.balances', {
defaultValue: 'balances'
})}
>
<CardSummary label={t('balances')}>
{this.renderBalances()}
</CardSummary>
</section>
@ -76,16 +64,14 @@ class Summary extends React.PureComponent<Props> {
return (
<div className='staking--Summary-text'>
<div>{t('summary.balance.validator', {
defaultValue: 'lowest validator {{validatorLow}}',
<div>{t('lowest validator {{validatorLow}}', {
replace: {
validatorLow: validatorLow && validatorLow.stakingBalance
? `${balanceFormat(validatorLow.stakingBalance)} ${nominatedLow}`
: '-'
}
})}</div>
<div>{t('summary.balance.stake', {
defaultValue: 'highest intention {{intentionHigh}}',
<div>{t('highest intention {{intentionHigh}}', {
replace: {
intentionHigh: intentionHigh
? `${balanceFormat(intentionHigh.stakingBalance)} ${nominatedHigh}`

View File

@ -131,17 +131,13 @@ class Account extends React.PureComponent<Props, State> {
<Button
isPrimary
onClick={this.stake}
text={t('account.stake', {
defaultValue: 'stake'
})}
text={t('Stake')}
/>
<Button.Or />
<Button
isPrimary
onClick={this.toggleNominate}
text={t('account.nominate', {
defaultValue: 'nominate'
})}
text={t('Nominate')}
/>
</Button.Group>
);
@ -164,9 +160,7 @@ class Account extends React.PureComponent<Props, State> {
<Button
isNegative
onClick={this.unstake}
text={t('account.unstake', {
defaultValue: 'unstake'
})}
text={t('Unstake')}
/>
</Button.Group>
);

View File

@ -66,18 +66,14 @@ class Nominating extends React.PureComponent<Props> {
<Button
isNegative
onClick={onClose}
text={t('nominators.cancel', {
defaultValue: 'Cancel'
})}
text={t('Cancel')}
/>
<Button.Or />
<Button
isDisabled={!isNomineeValid}
isPrimary
onClick={this.nominate}
text={t('nominator.nominate', {
defaultValue: 'nominate'
})}
text={t('Nominate')}
/>
</Button.Group>
</Modal.Actions>
@ -90,17 +86,13 @@ class Nominating extends React.PureComponent<Props> {
return [
<Modal.Header key='header'>
{t('nominator.header', {
defaultValue: 'Nominate Validator'
})}
{t('Nominate Validator')}
</Modal.Header>,
<Modal.Content className='ui--signer-Signer-Content' key='content'>
<Input
className='medium'
isError={!isNomineeValid}
label={t('nominator.address', {
defaultValue: 'nominate the following address (validator or intention)'
})}
label={t('nominate the following address (validator or intention)')}
onChange={this.onChangeNominee}
value={nominee}
/>
@ -122,16 +114,12 @@ class Nominating extends React.PureComponent<Props> {
<article className='error'>
{
!isNomineeValid && isAddressFormatValid
? t('nominator.error', {
defaultValue: 'The address you input is not intending to stake, and is therefore invalid. Please try again with a validator address.'
})
? t('The address you input is not intending to stake, and is therefore invalid. Please try again with a validator address.')
: null
}
{
!isAddressFormatValid
? t('nominator.error', {
defaultValue: 'The address does not conform to a recognized address format. Please make sure you enter a valid address.'
})
? t('The address does not conform to a recognized address format. Please make sure you enter a valid address.')
: null
}
</article>

View File

@ -31,9 +31,7 @@ class UnnominateButton extends React.Component<Props> {
style={style}
isNegative
onClick={this.onClick}
text={t('account.unnominate', {
defaultValue: 'unnominate'
})}
text={t('Unnominate')}
/>
);
}

View File

@ -66,11 +66,11 @@ class App extends React.PureComponent<Props, State> {
const items = [
{
name: 'overview',
text: t('app.overview', { defaultValue: 'Staking Overview' })
text: t('Staking Overview')
},
{
name: 'actions',
text: t('app.actions', { defaultValue: 'Account Actions' })
text: t('Account Actions')
}
];

View File

@ -55,9 +55,7 @@ class Modules extends React.PureComponent<Props, State> {
<div className='storage--actionrow-value'>
<InputStorage
defaultValue={this.defaultValue}
labelSection={t('selection.section', {
defaultValue: 'query state section'
})}
labelSection={t('query state section')}
onChange={this.onChangeKey}
/>
<Params

View File

@ -42,9 +42,7 @@ class Raw extends React.PureComponent<Props, State> {
<div className='storage--actionrow-value'>
<Input
autoFocus
label={t('raw.label', {
defaultValue: 'hex-encoded storage key'
})}
label={t('hex-encoded storage key')}
onChange={this.onChangeKey}
/>
</div>

View File

@ -42,11 +42,11 @@ class Selection extends React.PureComponent<Props, State> {
items: [
{
name: 'modules',
text: t('select.modules', { defaultValue: 'Modules' })
text: t('Modules')
},
{
name: 'raw',
text: t('select.raw', { defaultValue: 'Raw key' })
text: t('Raw key')
}
]
};

View File

@ -42,25 +42,17 @@ class Hash extends React.PureComponent<Props, State> {
<Input
autoFocus
className='large'
label={t('hash.data', {
defaultValue: 'from the following data (hex or string)'
})}
label={t('from the following data (hex or string)')}
onChange={this.onChangeData}
value={data}
/>
<Static
className='small'
label={t('hash.isHex', {
defaultValue: 'hex input data'
})}
label={t('hex input data')}
value={
isHexData
? t('hash.isHex.yes', {
defaultValue: 'Yes'
})
: t('hash.isHex.no', {
defaultValue: 'No'
})
? t('Yes')
: t('No')
}
/>
</div>
@ -76,9 +68,7 @@ class Hash extends React.PureComponent<Props, State> {
<Output
className='full toolbox--hex'
isHidden={hash.length === 0}
label={t('hash.output', {
defaultValue: 'the resulting hash is'
})}
label={t('the resulting hash is')}
value={hash}
withCopy
/>

View File

@ -69,9 +69,7 @@ class Sign extends React.PureComponent<Props, State> {
className='full'
defaultValue={defaultValue}
isInput={false}
label={t('sign.account', {
defaultValue: 'using my account'
})}
label={t('using my account')}
onChange={this.onChangeAccount}
type='account'
/>
@ -92,9 +90,7 @@ class Sign extends React.PureComponent<Props, State> {
<Button
isPrimary
onClick={this.toggleUnlock}
text={t('sign.unlock', {
defaultValue: 'Unlock account'
})}
text={t('Unlock account')}
/>
</Button.Group>
);
@ -109,25 +105,17 @@ class Sign extends React.PureComponent<Props, State> {
<Input
autoFocus
className='large'
label={t('sign.data', {
defaultValue: 'sign the following data (hex or string)'
})}
label={t('sign the following data (hex or string)')}
onChange={this.onChangeData}
value={data}
/>
<Static
className='small'
label={t('sign.isHex', {
defaultValue: 'hex input data'
})}
label={t('hex input data')}
value={
isHexData
? t('sign.isHex.yes', {
defaultValue: 'Yes'
})
: t('sign.isHex.no', {
defaultValue: 'No'
})
? t('Yes')
: t('No')
}
/>
</div>
@ -143,9 +131,7 @@ class Sign extends React.PureComponent<Props, State> {
<Output
className='full toolbox--hex'
isHidden={signature.length === 0}
label={t('sign.signed', {
defaultValue: 'signature of supplied data'
})}
label={t('signature of supplied data')}
value={signature}
withCopy
/>

View File

@ -16,15 +16,10 @@ type Props = I18nProps & {
pair: KeyringPair | null
};
type UnlockI18n = {
key: string,
value: any // I18Next$Translate$Config
};
type State = {
address: string,
password: string,
unlockError: UnlockI18n | null
unlockError: string | null
};
class Unlock extends React.PureComponent<Props, State> {
@ -52,9 +47,7 @@ class Unlock extends React.PureComponent<Props, State> {
open
>
<Modal.Header>
{t('unlock.header', {
defaultValue: 'Unlock account'
})}
{t('Unlock account')}
</Modal.Header>
<Modal.Content>
{this.renderContent()}
@ -74,17 +67,13 @@ class Unlock extends React.PureComponent<Props, State> {
<Button
isNegative
onClick={this.onCancel}
text={t('unlock.cancel', {
defaultValue: 'Cancel'
})}
text={t('Cancel')}
/>
<Button.Or />
<Button
isPrimary
onClick={this.onUnlock}
text={t('unlock.doit', {
defaultValue: 'Unlock'
})}
text={t('Unlock')}
/>
</Button.Group>
);
@ -98,7 +87,7 @@ class Unlock extends React.PureComponent<Props, State> {
<div className='toolbox--Unlock-Content' key='content'>
<div className='expanded'>
<p>
<Trans i18nKey='unlock.info'>
<Trans>
You are about to unlock your account <span className='code'>{address}</span> to allow for the signing of messages.
</Trans>
</p>
@ -113,9 +102,7 @@ class Unlock extends React.PureComponent<Props, State> {
<Password
className='medium'
isError={!!unlockError}
label={t('unlock.password', {
defaultValue: 'unlock account using'
})}
label={t('unlock account using')}
onChange={this.onChangePassword}
value={password}
/>
@ -124,7 +111,7 @@ class Unlock extends React.PureComponent<Props, State> {
];
}
unlockAccount (password?: string): UnlockI18n | null {
unlockAccount (password?: string): string | null {
const { pair } = this.props;
if (!pair || !pair.isLocked()) {
@ -134,12 +121,7 @@ class Unlock extends React.PureComponent<Props, State> {
try {
pair.decodePkcs8(password);
} catch (error) {
return {
key: 'unlock.generic',
value: {
defaultValue: error.message
}
};
return error.message;
}
return null;

View File

@ -68,9 +68,7 @@ class Verify extends React.PureComponent<Props, State> {
defaultValue={defaultPublicKey}
isError={!isValidAddress}
isInput
label={t('verify.account', {
defaultValue: 'verify using address'
})}
label={t('verify using address')}
onChange={this.onChangeAddress}
/>
</div>
@ -86,25 +84,17 @@ class Verify extends React.PureComponent<Props, State> {
<Input
autoFocus
className='large'
label={t('verify.data', {
defaultValue: 'using the following data (hex or string)'
})}
label={t('using the following data (hex or string)')}
onChange={this.onChangeData}
value={data}
/>
<Static
className='small'
label={t('verify.isHex', {
defaultValue: 'hex input data'
})}
label={t('hex input data')}
value={
isHexData
? t('verify.isHex.yes', {
defaultValue: 'Yes'
})
: t('verify.isHex.no', {
defaultValue: 'No'
})
? t('Yes')
: t('No')
}
/>
</div>
@ -127,9 +117,7 @@ class Verify extends React.PureComponent<Props, State> {
/>
}
isError={!isValidSignature}
label={t('verify.signature', {
defaultValue: 'checking the supplied signature'
})}
label={t('checking the supplied signature')}
onChange={this.onChangeSignature}
value={signature}
/>

View File

@ -40,15 +40,15 @@ class ToolboxApp extends React.PureComponent<Props, State> {
const items = [
{
name: 'hash',
text: t('app.hash', { defaultValue: 'Hash data' })
text: t('Hash data')
},
{
name: 'sign',
text: t('app.sign', { defaultValue: 'Sign message' })
text: t('Sign message')
},
{
name: 'verify',
text: t('app.verify', { defaultValue: 'Verify signature' })
text: t('Verify signature')
}
];

View File

@ -31,9 +31,7 @@ class Submit extends React.PureComponent<Props> {
isDisabled={isDisabled || !extrinsic}
isPrimary
onClick={this.onMakeTransfer}
text={t('maketransfer', {
defaultValue: 'Make Transfer'
})}
text={t('Make Transfer')}
/>
</Button.Group>
);

View File

@ -57,18 +57,14 @@ class Transfer extends React.PureComponent<Props, State> {
<div className='ui--row'>
<div className='medium'>
<InputAddress
label={t('from', {
defaultValue: 'transfer from my account'
})}
label={t('transfer from my account')}
onChange={this.onChangeFrom}
type='account'
/>
</div>
<div className='medium'>
<InputAddress
label={t('to', {
defaultValue: 'to the recipient address'
})}
label={t('to the recipient address')}
onChange={this.onChangeTo}
type='all'
/>
@ -82,9 +78,7 @@ class Transfer extends React.PureComponent<Props, State> {
bitLength={DEFAULT_BITLENGTH}
isError={!hasAvailable}
isSi
label={t('amount', {
defaultValue: 'send a value of'
})}
label={t('send a value of')}
onChange={this.onChangeAmount}
/>
<FeeDisplay

View File

@ -29,13 +29,10 @@ class Connecting extends React.PureComponent<Props> {
return (
<div className='apps--Connecting'>
<div className='apps--Connecting-text'>
{t('connecting.disconnected', {
defaultValue: 'You are not connected to a node. Ensure that your node is running and that the Websocket endpoint is reachable.'
})}&nbsp;
{t('You are not connected to a node. Ensure that your node is running and that the Websocket endpoint is reachable.')}&nbsp;
{
isFirefox && settings.apiUrl.indexOf('ws://') === 0
? t('connecting.ff', {
defaultValue: 'With the Firefox browser connecting to insecure WebSockets (in this case {{url}}) will fail due to the browser not allowing localhost access from a secure site.',
? t('With the Firefox browser connecting to insecure WebSockets (in this case {{url}}) will fail due to the browser not allowing localhost access from a secure site.', {
replace: {
url: settings.apiUrl
}

View File

@ -39,9 +39,7 @@ class Content extends React.Component<Props> {
if (isApiGated && (!isApiReady || !isApiConnected)) {
return (
<div className='apps--Content-body'>
<main>{t('content.gated', {
defaultValue: 'Waiting for API to be connected and ready.'
})}</main>
<main>{t('Waiting for API to be connected and ready.')}</main>
</div>
);
}

View File

@ -47,9 +47,7 @@ class Status extends React.PureComponent<Props> {
account,
action: `${section}.${method}`,
status: 'event',
message: t('status.transfer', {
defaultValue: 'transfer received'
})
message: t('transfer received')
});
}
} else if (section === 'democracy') {
@ -58,8 +56,7 @@ class Status extends React.PureComponent<Props> {
queueAction({
action: `${section}.${method}`,
status: 'event',
message: t('status.democracy', {
defaultValue: 'update on #{{index}}',
message: t('update on #{{index}}', {
replace: {
index
}

View File

@ -140,9 +140,7 @@ class AddressSummary extends React.PureComponent<Props> {
<BalanceDisplay
balance={balance}
className='ui--AddressSummary-balance'
label={t('addressSummary.balance', {
defaultValue: 'balance '
})}
label={t('balance ')}
value={value}
/>
);
@ -184,9 +182,7 @@ class AddressSummary extends React.PureComponent<Props> {
className='ui--AddressSummary-nonce'
params={accountId.toString()}
>
{t('addressSummary.transactions', {
defaultValue: ' transactions'
})}
{t(' transactions')}
</Nonce>
);
}

View File

@ -24,9 +24,7 @@ class ButtonOr extends React.PureComponent<Props> {
style={style}
text={
isUndefined(text)
? t('button.or', {
defaultValue: 'or'
})
? t('or')
: text
}
/>

View File

@ -36,13 +36,9 @@ class CopyIcon extends React.PureComponent<CopyProps> {
if (queueAction) {
queueAction({
account,
action: t('identicon.copy', {
defaultValue: 'clipboard'
}),
action: t('clipboard'),
status: 'queued',
message: t('identicon.copied', {
defaultValue: 'address copied'
})
message: t('address copied')
});
}
}

View File

@ -38,9 +38,7 @@ class SelectMethod extends React.PureComponent<Props> {
<Dropdown
className={classes('ui--DropdownLinked-Items', className)}
isError={isError}
label={label || t('input.extrinsic.method', {
defaultValue: 'with the extrinsic'
})}
label={label || t('with the extrinsic')}
onChange={onChange}
options={options}
style={style}

View File

@ -31,9 +31,7 @@ class SelectSection extends React.PureComponent<Props> {
className={classes('ui--DropdownLinked-Sections', className)}
defaultValue={defaultValue}
isError={isError}
label={label || t('input.extrinsic.section', {
defaultValue: 'from extrinsic section'
})}
label={label || t('from extrinsic section')}
onChange={onChange}
options={options}
style={style}

View File

@ -59,11 +59,8 @@ class InputFile extends React.PureComponent<Props, State> {
<div className='label'>
{
!file
? placeholder || t('file.dnd', {
defaultValue: 'drag and drop the file here'
})
: placeholder || t('file.description', {
defaultValue: '{{name}} ({{size}} bytes)',
? placeholder || t('drag and drop the file here')
: placeholder || t('{{name}} ({{size}} bytes)', {
replace: file
})
}

View File

@ -100,9 +100,7 @@ class InputNumber extends React.PureComponent<Props, State> {
onChange={this.onChange}
onKeyDown={this.onKeyDown}
onKeyUp={this.onKeyUp}
placeholder={t('inputnumber.placeholder', {
defaultValue: 'Positive number'
})}
placeholder={t('Positive number')}
type='text'
>
{this.renderSiDropdown()}

View File

@ -38,9 +38,7 @@ class SelectMethod extends React.PureComponent<Props> {
<Dropdown
className={classes('ui--DropdownLinked-Items', className)}
isError={isError}
label={label || t('input.rpc.method', {
defaultValue: 'with method name'
})}
label={label || t('with method name')}
onChange={onChange}
options={options}
style={style}

View File

@ -31,9 +31,7 @@ class SelectSection extends React.PureComponent<Props> {
className={classes('ui--DropdownLinked-Sections', className)}
defaultValue={defaultValue}
isError={isError}
label={label || t('input.rpc.section', {
defaultValue: 'rpc area'
})}
label={label || t('rpc area')}
onChange={onChange}
options={options}
style={style}

View File

@ -38,9 +38,7 @@ class SelectKey extends React.PureComponent<Props> {
<Dropdown
className={classes('ui--DropdownLinked-Items', className)}
isError={isError}
label={label || t('input.storage.key', {
defaultValue: 'with state key'
})}
label={label || t('with state key')}
onChange={onChange}
options={options}
style={style}

View File

@ -31,9 +31,7 @@ class SelectSection extends React.PureComponent<Props> {
className={classes('ui--DropdownLinked-Sections', className)}
defaultValue={defaultValue}
isError={isError}
label={label || t('input.storage.section', {
defaultValue: 'state section'
})}
label={label || t('state section')}
onChange={onChange}
options={options}
style={style}

View File

@ -3,18 +3,18 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import i18n from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import Backend from 'i18next-xhr-backend';
// import LanguageDetector from 'i18next-browser-languagedetector';
// import Backend from 'i18next-xhr-backend';
import { reactI18nextModule } from 'react-i18next';
i18n
.use(Backend)
.use(LanguageDetector)
// .use(Backend)
// .use(LanguageDetector)
.use(reactI18nextModule)
.init({
backend: {
loadPath: 'locales/{{lng}}/{{ns}}.json'
},
// backend: {
// loadPath: 'locales/{{lng}}/{{ns}}.json'
// },
debug: false,
defaultNS: 'ui',
fallbackLng: 'en',

View File

@ -41,9 +41,7 @@ class KeyValueArray extends React.PureComponent<Props, State> {
constructor (props: Props) {
super(props);
this.placeholderEmpty = props.t('kvarray.empty', {
defaultValue: 'drag and drop JSON key/value (hex-encoded) file'
});
this.placeholderEmpty = props.t('drag and drop JSON key/value (hex-encoded) file');
this.state = {
placeholder: this.placeholderEmpty
};
@ -108,8 +106,7 @@ class KeyValueArray extends React.PureComponent<Props, State> {
encoded = this.parseFile(raw);
this.setState({
placeholder: t('kvarray.values', {
defaultValue: '{{count}} key/value pairs encoded for submission',
placeholder: t('{{count}} key/value pairs encoded for submission', {
replace: {
count: encoded.value.length
}

View File

@ -32,9 +32,7 @@ class Unknown extends React.PureComponent<Props> {
<Static
className='full'
label={label}
value={value || t('unknown.empty', {
defaultValue: 'empty'
})}
value={value || t('empty')}
/>
</Bare>
);

View File

@ -97,17 +97,13 @@ class Vector extends React.PureComponent<Props, State> {
<Button
isPrimary
onClick={this.rowAdd}
text={t('vector.add', {
defaultValue: 'add item'
})}
text={t('Add item')}
/>
<Button
isDisabled={values.length === 1}
isNegative
onClick={this.rowRemove}
text={t('vector.remove', {
defaultValue: 'remove item'
})}
text={t('Remove item')}
/>
</div>
);

View File

@ -63,8 +63,7 @@ class Proposal extends React.PureComponent<Props, State> {
return [
isBelowMinimum
? <div key='belowmin'><Icon name='warning sign' />{t('proposal.belowmin', {
defaultValue: 'The deposit is below the {{minimum}} minimum required for the proposal to be evaluated',
? <div key='belowmin'><Icon name='warning sign' />{t('The deposit is below the {{minimum}} minimum required for the proposal to be evaluated', {
replace: {
minimum: balanceFormat(democracy_minimumDeposit)
}
@ -72,8 +71,7 @@ class Proposal extends React.PureComponent<Props, State> {
: undefined,
extraAmount.isZero()
? undefined
: <div key='infodeposit'><Icon name='arrow right' />{t('proposal.deposit', {
defaultValue: 'The deposit of {{deposit}} will be reserved until the proposal is completed',
: <div key='infodeposit'><Icon name='arrow right' />{t('The deposit of {{deposit}} will be reserved until the proposal is completed', {
replace: {
deposit: balanceFormat(extraAmount)
}

View File

@ -74,13 +74,10 @@ class Transfer extends React.PureComponent<Props, State> {
return [
isNoEffect
? <div key='noeffect'><Icon name='warning sign' />{t('transfer.noeffect', {
defaultValue: 'The final recipient amount is less than the existential amount, hence the total will be deducted from the sender, however the recipient account will not reflect the amount sent'
})}</div>
? <div key='noeffect'><Icon name='warning sign' />{t('The final recipient amount is less than the existential amount, hence the total will be deducted from the sender, however the recipient account will not reflect the amount sent')}</div>
: undefined,
isCreation
? <div key='create'><Icon name='warning sign' />{t('transfer.create', {
defaultValue: 'A fee of {{creationFee}} will be deducted from the sender since the destination account does not exist',
? <div key='create'><Icon name='warning sign' />{t('A fee of {{creationFee}} will be deducted from the sender since the destination account does not exist', {
replace: {
creationFee: `${balanceFormat(fees.creationFee)}`
}

View File

@ -141,36 +141,26 @@ class FeeDisplay extends React.PureComponent<Props, State> {
{
hasAvailable
? undefined
: <div><Icon name='ban' />{t('fees.available', {
defaultValue: 'The account does not have the required funds available for this transaction with the current provided values'
})}</div>
: <div><Icon name='ban' />{t('The account does not have the required funds available for this transaction with the current provided values')}</div>
}
{this.renderTransfer()}
{this.renderProposal()}
{
isRemovable && hasAvailable
? <div><Icon name='warning sign' />{t('fees.remove', {
defaultValue: 'Submitting this transaction will drop the account balance to below the existential amount, removing the account from the chain state and burning associated funds'
})}</div>
? <div><Icon name='warning sign' />{t('Submitting this transaction will drop the account balance to below the existential amount, removing the account from the chain state and burning associated funds')}</div>
: undefined
}{
isReserved
? <div><Icon name='arrow right' />{t('fees.reserved', {
defaultValue: 'This account does have a reserved/locked balance, not taken into account'
})}</div>
? <div><Icon name='arrow right' />{t('This account does have a reserved/locked balance, not taken into account')}</div>
: undefined
}
<div><Icon name='arrow right' />{t('fees.explain', {
defaultValue: 'Fees includes the transaction fee and the per-byte fee'
})}</div>
<div><Icon name='arrow right' />{t('fees', {
defaultValue: 'Fees totalling {{fees}} will be applied to the submission',
<div><Icon name='arrow right' />{t('Fees includes the transaction fee and the per-byte fee')}</div>
<div><Icon name='arrow right' />{t('Fees totalling {{fees}} will be applied to the submission', {
replace: {
fees: balanceFormat(allFees)
}
})}</div>
<div><Icon name='arrow right' />{t('total', {
defaultValue: '{{total}} total transaction amount (fees + value)',
<div><Icon name='arrow right' />{t('{{total}} total transaction amount (fees + value)', {
replace: {
total: balanceFormat(allTotal)
}

View File

@ -113,9 +113,7 @@ class Signer extends React.PureComponent<Props, State> {
isNegative
onClick={this.onCancel}
tabIndex={3}
text={t('extrinsic.cancel', {
defaultValue: 'Cancel'
})}
text={t('Cancel')}
/>
<Button.Or />
<Button
@ -125,12 +123,8 @@ class Signer extends React.PureComponent<Props, State> {
tabIndex={2}
text={
currentItem.isUnsigned
? t('extrinsic.unsignedSend', {
defaultValue: 'Submit (no signature)'
})
: t('extrinsic.signedSend', {
defaultValue: 'Sign and Submit'
})
? t('Submit (no signature)')
: t('Sign and Submit')
}
/>
</Button.Group>

View File

@ -45,9 +45,7 @@ class Transaction extends React.PureComponent<Props> {
return [
<Modal.Header key='header'>
{t('extrinsic.header', {
defaultValue: 'Submit Transaction'
})}
{t('Submit Transaction')}
</Modal.Header>,
<Modal.Content className='ui--signer-Signer-Content' key='content'>
<div className='ui--signer-Signer-Decoded'>

View File

@ -57,9 +57,7 @@ class Unlock extends React.PureComponent<Props, State> {
autoFocus={autoFocus}
className='medium'
isError={isError}
label={label || t('unlock.password', {
defaultValue: 'unlock account using the password'
})}
label={label || t('unlock account using the password')}
onChange={onChange}
onKeyDown={onKeyDown}
tabIndex={tabIndex}