Skip to content

Commit

Permalink
fix - script to generate locales (now match defaultMessage using doub…
Browse files Browse the repository at this point in the history
…le quotes)

fix - about 20 formattedMessage using {} or {``}
  • Loading branch information
Lyncee59 committed May 23, 2018
1 parent 4261396 commit d294c24
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 1,120 deletions.
1,089 changes: 1 addition & 1,088 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
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Trade = ({ trade, close }) => {
{ bodyStatus.text }
</Text>
<Text style={spacing('pt-5')} size='13px' weight={300}>
<FormattedMessage id='order_details.trade_id' defaultMessage={`Your order ID is: CNY-{id}`} values={{ id: trade.id }} />
<FormattedMessage id='order_details.trade_id' defaultMessage='Your order ID is: CNY-{id}' values={{ id: trade.id }} />
</Text>
<OrderDetailsTable style={spacing('mt-10')}>
{renderDetailsRow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class SfoxTradeDetails extends React.PureComponent {
{ bodyStatus.text }
</Text>
<Text style={spacing('pt-5')} size='13px' weight={300}>
<FormattedMessage id='order_details.trade_id' defaultMessage={`Your order ID is: SFX-{id}`} values={{ id: trade.id }} />
<FormattedMessage id='order_details.trade_id' defaultMessage='Your order ID is: SFX-{id}' values={{ id: trade.id }} />
</Text>
<Text style={spacing('mt-20')} size='14px' weight={400}>
{ trade.isBuy ? <FormattedMessage id='order_details.method' defaultMessage='Payment Method' /> : <FormattedMessage id='order_details.receiving_funds_into' defaultMessage='Receiving Funds Into' /> }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const Success = props => {
<TableRow>
<TableCell>
<Text size='13px' weight={400}>
<FormattedMessage id='scenes.exchange.shapeshift.secondstep.todeposit' defaultMessage={'{sourceCoin} to deposit:'} values={{ sourceCoin }} />
<FormattedMessage id='scenes.exchange.shapeshift.secondstep.todeposit' defaultMessage='{coin} to deposit:' values={{ coin: sourceCoin }} />
</Text>
</TableCell>
<TableCell>
Expand All @@ -115,7 +115,7 @@ const Success = props => {
<TableRow>
<TableCell>
<Text size='13px' weight={400}>
<FormattedMessage id='scenes.exchange.shapeshift.secondstep.leaving' defaultMessage={'Total {sourceCoin} leaving the wallet'} values={{ sourceCoin }} />
<FormattedMessage id='scenes.exchange.shapeshift.secondstep.leaving' defaultMessage='Total {sourceCoin} leaving the wallet' values={{ sourceCoin }} />
</Text>
</TableCell>
<TableCell>
Expand Down Expand Up @@ -151,7 +151,7 @@ const Success = props => {
<TableRow>
<TableCell>
<Text size='13px' weight={400}>
<FormattedMessage id='scenes.exchange.shapeshift.exchangebox.secondstep.tobereceived' defaultMessage={`${targetCoin} to be received`} />
<FormattedMessage id='scenes.exchange.shapeshift.exchangebox.secondstep.tobereceived' defaultMessage='{coin} to be received' values={{ coin: targetCoin }} />
</Text>
</TableCell>
<TableCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ export const kycNotificationBodyHelper = (status) => {
case 'rejected': return { text: <FormattedMessage id='scenes.coinify_details_modal.kyc.rejected' defaultMessage='There was an issue verifying your identity with the documents provided. Please try uploading different identification. Bank transfers are unavailable until we can successfully verify your identity.' /> }
case 'failed': return { text: <FormattedMessage id='scenes.coinify_details_modal.kyc.failed' defaultMessage='Your identity verification has failed. Please contact support.' /> }
case 'cancelled': return { text: <FormattedMessage id='scenes.coinify_details_modal.kyc.cancelled' defaultMessage='Your identity verification was cancelled. Please try again.' /> }
default: return { color: '', text: <FormattedMessage id='scenes.coinify_details_modal.kyc.header.unknown' defaultMessage='Unknown' /> }
default: return { color: '', text: <FormattedMessage id='scenes.coinify_details_modal.kyc.header.unknown2' defaultMessage='Unknown' /> }
}
}

export const kycNotificationButtonHelper = (status) => {
switch (status) {
case 'pending': return { color: 'transferred', text: <FormattedMessage id='scenes.buy_sell.kyc_notification.complete' defaultMessage='Complete Verification' /> }
case 'rejected': return { color: 'error', text: <FormattedMessage id='scenes.buy_sell.kyc_notification.rejected' defaultMessage='Try Again' /> }
default: return { color: '', text: <FormattedMessage id='scenes.coinify_details_modal.kyc.header.unknown' defaultMessage='' /> }
default: return { color: '', text: <FormattedMessage id='scenes.coinify_details_modal.kyc.header.unknown3' defaultMessage='Unknown' /> }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const rootPath = path.resolve(`${__dirname}/../src`)
const outputPath = rootPath + '/assets/locales'
const outputFilename = 'en.json'
// const regexIntlImport = new RegExp(/.+from['" ]+react-intl['" ]+/)
const regexIntlComponent = new RegExp(/(<FormattedMessage[^>]+\/>|<FormattedHtmlMessage[^>]+\/>)/, 'gm')
const regexIntlComponent = new RegExp(/(<FormattedMessage[^>]+\/>)/, 'gm')
const regexIntlId = new RegExp(/id='([^']+)'/)
const regexIntlMessage = new RegExp(/defaultMessage='([^']+)'/)
const regexIntlMessage = new RegExp(/defaultMessage='([^']+)'|defaultMessage="(.+)"/)

const isNotNil = compose(not, isNil)

Expand Down Expand Up @@ -52,7 +52,7 @@ export const toKeyValue = element => {
if (isNotNil(id) && isNotNil(message)) {
return {[id[1]]: message[1]}
} else {
console.warn('FAILED TO ADD KEY: ', id, message)
console.warn('FAILED TO ADD KEY : ', (id || [])[1], (message || [])[1])
return {}
}
}
Expand All @@ -68,6 +68,6 @@ filenames(rootPath + '/**/*.js')
.map(filter(isNotNil))
.map(flatten)
.map(reduce(mapReducer, {}))
.map(toString)
// .map(toString)
.chain(writeFile(outputPath + '/' + outputFilename))
.fork(console.warn, console.log)

0 comments on commit d294c24

Please sign in to comment.