Commit c9e2f86e authored by lynn's avatar lynn Committed by GitHub

feat: add i18n to token detail and token explore (#4510)

init
parent 8c019911
import { Trans } from '@lingui/macro'
import { useToken } from 'hooks/Tokens' import { useToken } from 'hooks/Tokens'
import { useNetworkTokenBalances } from 'hooks/useNetworkTokenBalances' import { useNetworkTokenBalances } from 'hooks/useNetworkTokenBalances'
import { useState } from 'react' import { useState } from 'react'
...@@ -152,7 +153,9 @@ export default function FooterBalanceSummary({ ...@@ -152,7 +153,9 @@ export default function FooterBalanceSummary({
) : error ? ( ) : error ? (
<ErrorState> <ErrorState>
<AlertTriangle size={17} /> <AlertTriangle size={17} />
<ErrorText>There was an error fetching your balance</ErrorText> <ErrorText>
<Trans>There was an error fetching your balance</Trans>
</ErrorText>
</ErrorState> </ErrorState>
) : ( ) : (
<BalanceInfo> <BalanceInfo>
...@@ -165,16 +168,21 @@ export default function FooterBalanceSummary({ ...@@ -165,16 +168,21 @@ export default function FooterBalanceSummary({
</BalanceTotal> </BalanceTotal>
{multipleBalances && ( {multipleBalances && (
<ViewAll onClick={() => setShowMultipleBalances(!showMultipleBalances)}> <ViewAll onClick={() => setShowMultipleBalances(!showMultipleBalances)}>
{showMultipleBalances ? 'Hide' : 'View'} all balances <Trans>{showMultipleBalances ? 'Hide' : 'View'} all balances</Trans>
</ViewAll> </ViewAll>
)} )}
</BalanceInfo> </BalanceInfo>
)} )}
<SwapButton onClick={() => (window.location.href = 'https://app.uniswap.org/#/swap')}>Swap</SwapButton> <SwapButton onClick={() => (window.location.href = 'https://app.uniswap.org/#/swap')}>
<Trans>Swap</Trans>
</SwapButton>
</TotalBalancesSection> </TotalBalancesSection>
{showMultipleBalances && ( {showMultipleBalances && (
<NetworkBalancesSection> <NetworkBalancesSection>
<NetworkBalancesLabel>Your balances by network</NetworkBalancesLabel> {networkBalances} <NetworkBalancesLabel>
<Trans>Your balances by network</Trans>
</NetworkBalancesLabel>{' '}
{networkBalances}
</NetworkBalancesSection> </NetworkBalancesSection>
)} )}
<FakeFooterNavBar>**leaving space for updated nav footer**</FakeFooterNavBar> <FakeFooterNavBar>**leaving space for updated nav footer**</FakeFooterNavBar>
......
import { Trans } from '@lingui/macro'
import { useOnClickOutside } from 'hooks/useOnClickOutside' import { useOnClickOutside } from 'hooks/useOnClickOutside'
import { useRef } from 'react' import { useRef } from 'react'
import { Twitter } from 'react-feather' import { Twitter } from 'react-feather'
...@@ -98,13 +99,13 @@ export default function ShareButton(tokenInfo: TokenInfo) { ...@@ -98,13 +99,13 @@ export default function ShareButton(tokenInfo: TokenInfo) {
toCopy={window.location.href} toCopy={window.location.href}
ref={copyHelperRef} ref={copyHelperRef}
> >
Copy Link <Trans>Copy Link</Trans>
</CopyHelper> </CopyHelper>
</ShareAction> </ShareAction>
<ShareAction onClick={shareTweet}> <ShareAction onClick={shareTweet}>
<Twitter color={theme.textPrimary} size={20} strokeWidth={1.5} /> <Twitter color={theme.textPrimary} size={20} strokeWidth={1.5} />
Share to Twitter <Trans>Share to Twitter</Trans>
</ShareAction> </ShareAction>
</ShareActions> </ShareActions>
)} )}
......
...@@ -245,7 +245,7 @@ export default function LoadedTokenDetail({ address }: { address: string }) { ...@@ -245,7 +245,7 @@ export default function LoadedTokenDetail({ address }: { address: string }) {
<StatsSection> <StatsSection>
<StatPair> <StatPair>
<Stat> <Stat>
Market cap <Trans>Market cap</Trans>
<StatPrice> <StatPrice>
{tokenDetailData.marketCap?.value ? formatDollarAmount(tokenDetailData.marketCap?.value) : '-'} {tokenDetailData.marketCap?.value ? formatDollarAmount(tokenDetailData.marketCap?.value) : '-'}
</StatPrice> </StatPrice>
...@@ -275,7 +275,7 @@ export default function LoadedTokenDetail({ address }: { address: string }) { ...@@ -275,7 +275,7 @@ export default function LoadedTokenDetail({ address }: { address: string }) {
<AboutSection address={address} tokenDetailData={relevantTokenDetailData} /> <AboutSection address={address} tokenDetailData={relevantTokenDetailData} />
<ContractAddressSection> <ContractAddressSection>
<Contract> <Contract>
Contract address <Trans>Contract address</Trans>
<ContractAddress> <ContractAddress>
<CopyContractAddress address={address} /> <CopyContractAddress address={address} />
</ContractAddress> </ContractAddress>
......
import { Trans } from '@lingui/macro'
import { useAtom } from 'jotai' import { useAtom } from 'jotai'
import { Heart } from 'react-feather' import { Heart } from 'react-feather'
import styled, { useTheme } from 'styled-components/macro' import styled, { useTheme } from 'styled-components/macro'
...@@ -38,7 +39,9 @@ export default function FavoriteButton() { ...@@ -38,7 +39,9 @@ export default function FavoriteButton() {
<StyledFavoriteButton onClick={() => setShowFavorites(!showFavorites)} active={showFavorites}> <StyledFavoriteButton onClick={() => setShowFavorites(!showFavorites)} active={showFavorites}>
<FavoriteButtonContent> <FavoriteButtonContent>
<Heart size={17} color={showFavorites ? theme.white : theme.textPrimary} fill="transparent" /> <Heart size={17} color={showFavorites ? theme.white : theme.textPrimary} fill="transparent" />
<FavoriteText>Favorites</FavoriteText> <FavoriteText>
<Trans>Favorites</Trans>
</FavoriteText>
</FavoriteButtonContent> </FavoriteButtonContent>
</StyledFavoriteButton> </StyledFavoriteButton>
) )
......
import { Trans } from '@lingui/macro'
import { import {
favoritesAtom, favoritesAtom,
filterStringAtom, filterStringAtom,
...@@ -161,7 +162,7 @@ export default function TokenTable({ data }: { data: TokenData[] | undefined }) ...@@ -161,7 +162,7 @@ export default function TokenTable({ data }: { data: TokenData[] | undefined })
message={ message={
<> <>
<AlertTriangle size={16} /> <AlertTriangle size={16} />
An error occured loading tokens. Please try again. <Trans>An error occured loading tokens. Please try again.</Trans>
</> </>
} }
/> />
...@@ -169,11 +170,11 @@ export default function TokenTable({ data }: { data: TokenData[] | undefined }) ...@@ -169,11 +170,11 @@ export default function TokenTable({ data }: { data: TokenData[] | undefined })
} }
if (showFavorites && sortedFilteredTokens?.length === 0) { if (showFavorites && sortedFilteredTokens?.length === 0) {
return <NoTokensState message="You have no favorited tokens" /> return <NoTokensState message={<Trans>You have no favorited tokens</Trans>} />
} }
if (!showFavorites && sortedFilteredTokens?.length === 0) { if (!showFavorites && sortedFilteredTokens?.length === 0) {
return <NoTokensState message="No tokens found" /> return <NoTokensState message={<Trans>No tokens found</Trans>} />
} }
return ( return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment