Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
chore(i18n): wrapped English text around <Trans> component (#1714)
Browse files Browse the repository at this point in the history
* feat(i18n): wrapped English text around <Trans> component

* cleanup

* synced

* regenerated locales
  • Loading branch information
Justin Domingue authored May 28, 2021
1 parent ad65b63 commit 46f539c
Show file tree
Hide file tree
Showing 50 changed files with 13,024 additions and 392 deletions.
5 changes: 4 additions & 1 deletion src/components/AccountDetails/Copy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import useCopyClipboard from '../../hooks/useCopyClipboard'

import { LinkStyledButton } from '../../theme'
import { CheckCircle, Copy } from 'react-feather'
import { Trans } from '@lingui/macro'

const CopyIcon = styled(LinkStyledButton)`
color: ${({ theme }) => theme.text3};
Expand Down Expand Up @@ -33,7 +34,9 @@ export default function CopyHelper(props: { toCopy: string; children?: React.Rea
{isCopied ? (
<TransactionStatusText>
<CheckCircle size={'16'} />
<TransactionStatusText>Copied</TransactionStatusText>
<TransactionStatusText>
<Trans id="common.copied">Copied</Trans>
</TransactionStatusText>
</TransactionStatusText>
) : (
<TransactionStatusText>
Expand Down
53 changes: 37 additions & 16 deletions src/components/AccountDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import Identicon from '../Identicon'
import { ButtonSecondary } from '../Button'
import { ExternalLink as LinkIcon } from 'react-feather'
import { ExternalLink, LinkStyledButton, TYPE } from '../../theme'
import { Trans } from '@lingui/macro'

const HeaderRow = styled.div`
${({ theme }) => theme.flexRowNoWrap};
Expand Down Expand Up @@ -237,7 +238,11 @@ export default function AccountDetails({
SUPPORTED_WALLETS[k].connector === connector && (connector !== injected || isMetaMask === (k === 'METAMASK'))
)
.map((k) => SUPPORTED_WALLETS[k].name)[0]
return <WalletName>Connected with {name}</WalletName>
return (
<WalletName>
<Trans id="wallet.connectedWith">Connected with {name}</Trans>
</WalletName>
)
}

function getStatusIcon() {
Expand All @@ -250,32 +255,32 @@ export default function AccountDetails({
} else if (connector === walletconnect) {
return (
<IconWrapper size={16}>
<img src={WalletConnectIcon} alt={'wallet connect logo'} />
<img src={WalletConnectIcon} alt={'WalletConnect logo'} />
</IconWrapper>
)
} else if (connector === walletlink) {
return (
<IconWrapper size={16}>
<img src={CoinbaseWalletIcon} alt={'coinbase wallet logo'} />
<img src={CoinbaseWalletIcon} alt={'Coinbase Wallet logo'} />
</IconWrapper>
)
} else if (connector === fortmatic) {
return (
<IconWrapper size={16}>
<img src={FortmaticIcon} alt={'fortmatic logo'} />
<img src={FortmaticIcon} alt={'Fortmatic logo'} />
</IconWrapper>
)
} else if (connector === portis) {
return (
<>
<IconWrapper size={16}>
<img src={PortisIcon} alt={'portis logo'} />
<img src={PortisIcon} alt={'Portis logo'} />
<MainWalletAction
onClick={() => {
portis.portis.showPortis()
}}
>
Show Portis
<Trans id="wallet.showPortis">Show Portis</Trans>
</MainWalletAction>
</IconWrapper>
</>
Expand All @@ -294,7 +299,9 @@ export default function AccountDetails({
<CloseIcon onClick={toggleWalletModal}>
<CloseColor />
</CloseIcon>
<HeaderRow>Account</HeaderRow>
<HeaderRow>
<Trans id="wallet.account">Account</Trans>
</HeaderRow>
<AccountSection>
<YourAccount>
<InfoCard>
Expand All @@ -308,7 +315,7 @@ export default function AccountDetails({
;(connector as any).close()
}}
>
Disconnect
<Trans id="wallet.disconnect">Disconnect</Trans>
</WalletAction>
)}
<WalletAction
Expand All @@ -317,7 +324,7 @@ export default function AccountDetails({
openOptions()
}}
>
Change
<Trans id="wallet.change">Change</Trans>
</WalletAction>
</div>
</AccountGroupingRow>
Expand Down Expand Up @@ -347,7 +354,9 @@ export default function AccountDetails({
<div>
{account && (
<Copy toCopy={account}>
<span style={{ marginLeft: '4px' }}>Copy Address</span>
<span style={{ marginLeft: '4px' }}>
<Trans id="wallet.copyAddress">Copy Address</Trans>
</span>
</Copy>
)}
{chainId && account && (
Expand All @@ -357,7 +366,9 @@ export default function AccountDetails({
href={getExplorerLink(chainId, ENSName, ExplorerDataType.ADDRESS)}
>
<LinkIcon size={16} />
<span style={{ marginLeft: '4px' }}>View on Etherscan</span>
<span style={{ marginLeft: '4px' }}>
<Trans id="wallet.viewOnEtherscan">View on Etherscan</Trans>
</span>
</AddressLink>
)}
</div>
Expand All @@ -369,7 +380,9 @@ export default function AccountDetails({
<div>
{account && (
<Copy toCopy={account}>
<span style={{ marginLeft: '4px' }}>Copy Address</span>
<span style={{ marginLeft: '4px' }}>
<Trans id="wallet.copyAddress">Copy Address</Trans>
</span>
</Copy>
)}
{chainId && account && (
Expand All @@ -379,7 +392,9 @@ export default function AccountDetails({
href={getExplorerLink(chainId, account, ExplorerDataType.ADDRESS)}
>
<LinkIcon size={16} />
<span style={{ marginLeft: '4px' }}>View on Etherscan</span>
<span style={{ marginLeft: '4px' }}>
<Trans id="wallet.viewOnEtherscan">View on Etherscan</Trans>
</span>
</AddressLink>
)}
</div>
Expand All @@ -394,15 +409,21 @@ export default function AccountDetails({
{!!pendingTransactions.length || !!confirmedTransactions.length ? (
<LowerSection>
<AutoRow mb={'1rem'} style={{ justifyContent: 'space-between' }}>
<TYPE.body>Recent Transactions</TYPE.body>
<LinkStyledButton onClick={clearAllTransactionsCallback}>(clear all)</LinkStyledButton>
<TYPE.body>
<Trans id="wallet.recentTransactions">Recent Transactions</Trans>
</TYPE.body>
<LinkStyledButton onClick={clearAllTransactionsCallback}>
<Trans id="wallet.clearAllTransactions">(clear all)</Trans>
</LinkStyledButton>
</AutoRow>
{renderTransactions(pendingTransactions)}
{renderTransactions(confirmedTransactions)}
</LowerSection>
) : (
<LowerSection>
<TYPE.body color={theme.text1}>Your transactions will appear here...</TYPE.body>
<TYPE.body color={theme.text1}>
<Trans id="wallet.yourTransactionsWillAppearHere">Your transactions will appear here...</Trans>
</TYPE.body>
</LowerSection>
)}
</>
Expand Down
7 changes: 6 additions & 1 deletion src/components/Blocklist/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { ReactNode, useMemo } from 'react'
import { useActiveWeb3React } from '../../hooks/web3'
import { Trans } from '@lingui/macro'

// SDN OFAC addresses
const BLOCKED_ADDRESSES: string[] = [
Expand All @@ -14,7 +15,11 @@ export default function Blocklist({ children }: { children: ReactNode }) {
const { account } = useActiveWeb3React()
const blocked: boolean = useMemo(() => Boolean(account && BLOCKED_ADDRESSES.indexOf(account) !== -1), [account])
if (blocked) {
return <div>Blocked address</div>
return (
<div>
<Trans id="blocklist.labels.blockedAddress">Blocked address</Trans>
</div>
)
}
return <>{children}</>
}
15 changes: 12 additions & 3 deletions src/components/CurrencyInputPanel/FiatValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import useTheme from '../../hooks/useTheme'
import { TYPE } from '../../theme'
import { warningSeverity } from '../../utils/prices'
import HoverInlineText from 'components/HoverInlineText'
import { Trans } from '@lingui/macro'

export function FiatValue({
fiatValue,
Expand All @@ -24,10 +25,18 @@ export function FiatValue({

return (
<TYPE.body fontSize={14} color={fiatValue ? theme.text2 : theme.text4}>
{fiatValue ? '~$' : ''}
<HoverInlineText text={fiatValue ? fiatValue?.toSignificant(6, { groupSeparator: ',' }) : ''} />{' '}
{fiatValue ? (
<Trans id="currencies.labels.fiatValue">
~$ <HoverInlineText text={fiatValue?.toSignificant(6, { groupSeparator: ',' })} />
</Trans>
) : (
''
)}
{priceImpact ? (
<span style={{ color: priceImpactColor }}> ({priceImpact.multiply(-1).toSignificant(3)}%)</span>
<span style={{ color: priceImpactColor }}>
{' '}
(<Trans id="numbers.valueWithPercent">{priceImpact.multiply(-1).toSignificant(3)}%</Trans>)
</span>
) : null}
</TYPE.body>
)
Expand Down
17 changes: 12 additions & 5 deletions src/components/Header/URLWarning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styled from 'styled-components/macro'
import { AlertTriangle, X } from 'react-feather'
import { useURLWarningToggle, useURLWarningVisible } from '../../state/user/hooks'
import { isMobile } from 'react-device-detect'
import { Trans } from '@lingui/macro'

const PhishAlert = styled.div<{ isActive: any }>`
width: 100%;
Expand All @@ -29,17 +30,23 @@ export default function URLWarning() {
return isMobile ? (
<PhishAlert isActive={showURLWarning}>
<div style={{ display: 'flex' }}>
<AlertTriangle style={{ marginRight: 6 }} size={12} /> Make sure the URL is
<code style={{ padding: '0 4px', display: 'inline', fontWeight: 'bold' }}>app.uniswap.org</code>
<AlertTriangle style={{ marginRight: 6 }} size={12} />
<Trans id="phish.urlWarning">
Make sure the URL is
<code style={{ padding: '0 4px', display: 'inline', fontWeight: 'bold' }}>app.uniswap.org</code>
</Trans>
</div>
<StyledClose size={12} onClick={toggleURLWarning} />
</PhishAlert>
) : window.location.hostname === 'app.uniswap.org' ? (
<PhishAlert isActive={showURLWarning}>
<div style={{ display: 'flex' }}>
<AlertTriangle style={{ marginRight: 6 }} size={12} /> Always make sure the URL is
<code style={{ padding: '0 4px', display: 'inline', fontWeight: 'bold' }}>app.uniswap.org</code> - bookmark it
to be safe.
<AlertTriangle style={{ marginRight: 6 }} size={12} />
<Trans id="phish.urlWarningLocationOk">
Always make sure the URL is
<code style={{ padding: '0 4px', display: 'inline', fontWeight: 'bold' }}>app.uniswap.org</code> - bookmark it
to be safe.
</Trans>
</div>
<StyledClose size={12} onClick={toggleURLWarning} />
</PhishAlert>
Expand Down
31 changes: 23 additions & 8 deletions src/components/Header/UniBalanceContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import useUSDCPrice from '../../hooks/useUSDCPrice'
import { AutoColumn } from '../Column'
import { RowBetween } from '../Row'
import { Break, CardBGImage, CardNoise, CardSection, DataCard } from '../earn/styled'
import { Trans } from '@lingui/macro'

const ContentWrapper = styled(AutoColumn)`
width: 100%;
Expand Down Expand Up @@ -65,7 +66,9 @@ export default function UniBalanceContent({ setShowUniBalanceModal }: { setShowU
<CardNoise />
<CardSection gap="md">
<RowBetween>
<TYPE.white color="white">Your UNI Breakdown</TYPE.white>
<TYPE.white color="white">
<Trans id="uni.yourUNIBreakdown">Your UNI Breakdown</Trans>
</TYPE.white>
<StyledClose stroke="white" onClick={() => setShowUniBalanceModal(false)} />
</RowBetween>
</CardSection>
Expand All @@ -81,16 +84,20 @@ export default function UniBalanceContent({ setShowUniBalanceModal }: { setShowU
</AutoColumn>
<AutoColumn gap="md">
<RowBetween>
<TYPE.white color="white">Balance:</TYPE.white>
<TYPE.white color="white">
<Trans id="claim.labels.balance">Balance:</Trans>
</TYPE.white>
<TYPE.white color="white">{uniBalance?.toFixed(2, { groupSeparator: ',' })}</TYPE.white>
</RowBetween>
<RowBetween>
<TYPE.white color="white">Unclaimed:</TYPE.white>
<TYPE.white color="white">
<Trans id="claim.unclaimed">Unclaimed:</Trans>
</TYPE.white>
<TYPE.white color="white">
{uniToClaim?.toFixed(4, { groupSeparator: ',' })}{' '}
{uniToClaim && uniToClaim.greaterThan('0') && (
<StyledInternalLink onClick={() => setShowUniBalanceModal(false)} to="/uni">
(claim)
<Trans id="claim.labels.claim">(claim)</Trans>
</StyledInternalLink>
)}
</TYPE.white>
Expand All @@ -103,19 +110,27 @@ export default function UniBalanceContent({ setShowUniBalanceModal }: { setShowU
<CardSection gap="sm">
<AutoColumn gap="md">
<RowBetween>
<TYPE.white color="white">UNI price:</TYPE.white>
<TYPE.white color="white">
<Trans id="uni.UNIPrice">UNI price:</Trans>
</TYPE.white>
<TYPE.white color="white">${uniPrice?.toFixed(2) ?? '-'}</TYPE.white>
</RowBetween>
<RowBetween>
<TYPE.white color="white">UNI in circulation:</TYPE.white>
<TYPE.white color="white">
<Trans id="uni.inCirculation">UNI in circulation:</Trans>
</TYPE.white>
<TYPE.white color="white">{circulation?.toFixed(0, { groupSeparator: ',' })}</TYPE.white>
</RowBetween>
<RowBetween>
<TYPE.white color="white">Total Supply</TYPE.white>
<TYPE.white color="white">
<Trans id="uni.totalSupply">Total Supply</Trans>
</TYPE.white>
<TYPE.white color="white">{totalSupply?.toFixed(0, { groupSeparator: ',' })}</TYPE.white>
</RowBetween>
{uni && uni.chainId === 1 ? (
<ExternalLink href={`https://info.uniswap.org/token/${uni.address}`}>View UNI Analytics</ExternalLink>
<ExternalLink href={`https://info.uniswap.org/token/${uni.address}`}>
<Trans id="uni.viewAnalytics">View UNI Analytics</Trans>
</ExternalLink>
) : null}
</AutoColumn>
</CardSection>
Expand Down
13 changes: 10 additions & 3 deletions src/components/InputStepCounter/InputStepCounter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { AutoColumn } from 'components/Column'
import { ButtonPrimary } from 'components/Button'
import { FeeAmount } from '@uniswap/v3-sdk'
import { formattedFeeAmount } from 'utils'
import { Trans } from '@lingui/macro'

const pulse = (color: string) => keyframes`
0% {
Expand Down Expand Up @@ -139,16 +140,22 @@ const StepCounter = ({
}}
/>
<InputTitle fontSize={12} textAlign="center">
{tokenB + ' per ' + tokenA}
<Trans id="currencies.denominated">
{tokenB} per {tokenA}
</Trans>
</InputTitle>
</AutoColumn>
{!locked ? (
<RowBetween>
<SmallButton onClick={handleDecrement}>
<TYPE.white fontSize="12px">-{feeAmountFormatted}%</TYPE.white>
<TYPE.white fontSize="12px">
<Trans id="inputs.feeAmount.minus">-{feeAmountFormatted}%</Trans>
</TYPE.white>
</SmallButton>
<SmallButton onClick={handleIncrement}>
<TYPE.white fontSize="12px">+{feeAmountFormatted}%</TYPE.white>
<TYPE.white fontSize="12px">
<Trans id="inputs.feeAmount.plus">+{feeAmountFormatted}%</Trans>
</TYPE.white>
</SmallButton>
</RowBetween>
) : null}
Expand Down
Loading

0 comments on commit 46f539c

Please sign in to comment.