Skip to content

Commit

Permalink
chore: improve translactions (#1447)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsimao authored Jul 20, 2023
1 parent ec96157 commit 79ac979
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 71 deletions.
52 changes: 29 additions & 23 deletions src/assets/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"update": "Update",
"collateralization": "Collateralization",
"fees_earned": "Fees earned",
"apy": "APR",
"apy": "APY",
"apr": "APR",
"here": "here",
"refresh_page.": "Once you create a new account please refresh the page.",
Expand All @@ -75,24 +75,6 @@
"locked_btc": "Locked BTC",
"issue": "Issue",
"redeem": "Redeem",
"nav_btc": "BTC",
"nav_strategies": "Strategies",
"nav_send_and_receive": "Send and Receive",
"nav_lending": "Lending",
"nav_swap": "Swap",
"nav_pools": "Pools",
"nav_staking": "Staking",
"nav_stats": "Stats",
"nav_dashboard": "Dashboard",
"nav_vaults": "Vaults",
"nav_crowdloan": "Claim {{governanceTokenSymbol}}",
"nav_feedback": "Feedback",
"nav_docs": "Docs",
"nav_terms_and_conditions": "Terms and Conditions",
"nav_use_wrapped": "Use {{wrappedTokenSymbol}}",
"nav_governance": "Governance",
"nav_wallet": "Wallet",
"nav_onboarding": "Onboarding",
"report_bug": "Report a bug:",
"request_funds": "Faucet",
"request_btc": "BTC Faucet",
Expand Down Expand Up @@ -165,7 +147,27 @@
"claim_rewards": "Claim Rewards",
"tx_fees": "Tx fees",
"view_subscan": "View Subscan",

"wallet": "Wallet",
"navigation": {
"btc": "BTC",
"strategies": "Strategies",
"send_and_receive": "Send and Receive",
"lending": "Lending",
"swap": "Swap",
"pools": "Pools",
"staking": "Staking",
"stats": "Stats",
"dashboard": "Dashboard",
"vaults": "Vaults",
"crowdloan": "Claim {{governanceTokenSymbol}}",
"feedback": "Feedback",
"docs": "Docs",
"terms_and_conditions": "Terms and Conditions",
"use_wrapped": "Use {{wrappedTokenSymbol}}",
"governance": "Governance",
"wallet": "Wallet",
"onboarding": "Onboarding"
},
"redeem_page": {
"maximum_in_single_request": "Max redeemable in single request",
"redeem": "Redeem",
Expand Down Expand Up @@ -575,7 +577,6 @@
"please_select_a_wallet": "Please select a wallet"
},
"loans": {
"brand_name": "Interlend",
"withdraw": "Withdraw",
"withdrawing": "Withdrawing",
"borrow": "Borrow",
Expand All @@ -588,7 +589,12 @@
"my_borrow_positions": "My Borrow Positions",
"action_liquidation_risk": "{{action}} this amount will increase your LTV, thus also increasing the risk of liquidation.",
"no_loan_positions": "No {{loanType}} positions",
"your_loan_positions_will_show_here": "Your {{loanType}} positions will show here"
"your_loan_positions_will_show_here": "Your {{loanType}} positions will show here",
"borrowed": "Borrowed",
"supplied": "Supplied",
"total_supplied": "Total Supplied",
"apy_earned": "APY / Earned",
"apy_accrued": "APY / Accrued"
},
"amm": {
"pools": {
Expand Down Expand Up @@ -637,7 +643,7 @@
"exchange": "Exchange",
"please_check_terms": "Please check the individual terms and conditions of each exchange before you buy / trade {{ticker}}."
},
"wallet": {
"wallet_page": {
"available_assets": "Available assets",
"get_asset": "Get {{token}}",
"no_assets_available": "No assets available",
Expand Down
16 changes: 8 additions & 8 deletions src/components/LoanPositionsTable/LoanPositionsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,24 @@ const LoanPositionsTable = ({
const columns = useMemo(() => {
if (isLending) {
const lendingColumns = [
{ name: 'Asset', uid: LoanPositionTableColumns.ASSET },
{ name: 'APY / Earned', uid: LoanPositionTableColumns.APY },
{ name: 'Supplied', uid: LoanPositionTableColumns.AMOUNT }
{ name: t('asset'), uid: LoanPositionTableColumns.ASSET },
{ name: t('loans.apy_earned'), uid: LoanPositionTableColumns.APY },
{ name: t('loans.supplied'), uid: LoanPositionTableColumns.AMOUNT }
];

if (showCollateral) {
lendingColumns.push({ name: 'Collateral', uid: LoanPositionTableColumns.COLLATERAL });
lendingColumns.push({ name: t('collateral'), uid: LoanPositionTableColumns.COLLATERAL });
}

return lendingColumns;
}

return [
{ name: 'Asset', uid: LoanPositionTableColumns.ASSET },
{ name: 'APY / Accrued', uid: LoanPositionTableColumns.APY },
{ name: 'Borrowed', uid: LoanPositionTableColumns.AMOUNT }
{ name: t('asset'), uid: LoanPositionTableColumns.ASSET },
{ name: t('loans.apy_accrued'), uid: LoanPositionTableColumns.APY },
{ name: t('loans.borrowed'), uid: LoanPositionTableColumns.AMOUNT }
];
}, [isLending, showCollateral]);
}, [isLending, showCollateral, t]);

const rows: LoanPositionTableRow[] = useMemo(
() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ type BorrowAssetsTableRow = {
[BorrowAssetsColumns.TOTAL_BORROWED]: ReactNode;
};

// TODO: translations
const borrowAssetsColumns = [
{ name: 'Asset', uid: BorrowAssetsColumns.ASSET },
{ name: 'APY', uid: BorrowAssetsColumns.APY },
{ name: 'Capacity', uid: BorrowAssetsColumns.CAPACITY },
{ name: 'Total Borrowed', uid: BorrowAssetsColumns.TOTAL_BORROWED }
];

type Props = {
assets: TickerToData<LoanAsset>;
};
Expand All @@ -48,6 +40,17 @@ const BorrowAssetsTable = ({ assets, onRowAction, ...props }: BorrowAssetsTableP
const { t } = useTranslation();
const prices = useGetPrices();

// TODO: translations
const borrowAssetsColumns = useMemo(
() => [
{ name: t('asset'), uid: BorrowAssetsColumns.ASSET },
{ name: t('apy'), uid: BorrowAssetsColumns.APY },
{ name: t('available'), uid: BorrowAssetsColumns.CAPACITY },
{ name: t('loans.borrowed'), uid: BorrowAssetsColumns.TOTAL_BORROWED }
],
[t]
);

const rows: BorrowAssetsTableRow[] = useMemo(
() =>
Object.values(assets).map(({ borrowApy, currency, availableCapacity, totalBorrows, borrowReward }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ type LendAssetsTableRow = {
[LendAssetsColumns.TOTAL_SUPPLY]: ReactNode;
};

// TODO: translations
const lendAssetsColumns = [
{ name: 'Asset', uid: LendAssetsColumns.ASSET },
{ name: 'APY', uid: LendAssetsColumns.APY },
{ name: 'Wallet', uid: LendAssetsColumns.WALLET },
{ name: 'Total Supplied', uid: LendAssetsColumns.TOTAL_SUPPLY }
];

type Props = {
assets: TickerToData<LoanAsset>;
};
Expand All @@ -48,6 +40,16 @@ const LendAssetsTable = ({ assets, onRowAction, ...props }: LendAssetsTableProps
const prices = useGetPrices();
const { data: balances } = useGetBalances();

const lendAssetsColumns = useMemo(
() => [
{ name: t('asset'), uid: LendAssetsColumns.ASSET },
{ name: t('apy'), uid: LendAssetsColumns.APY },
{ name: t('wallet'), uid: LendAssetsColumns.WALLET },
{ name: t('loans.total_supplied'), uid: LendAssetsColumns.TOTAL_SUPPLY }
],
[t]
);

const rows: LendAssetsTableRow[] = useMemo(
() =>
Object.values(assets).map(({ lendApy, currency, totalLiquidity, lendReward }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const AvailableAssetsTable = ({ balances, pooledTickers }: AvailableAssetsTableP
})
}}
>
{t('wallet.get_asset', { token: currency.ticker })}
{t('wallet_page.get_asset', { token: currency.ticker })}
</TextLink>
);

Expand Down Expand Up @@ -146,10 +146,10 @@ const AvailableAssetsTable = ({ balances, pooledTickers }: AvailableAssetsTableP
return (
<DataGrid
actions={actions}
title={t('wallet.available_assets')}
title={t('wallet_page.available_assets')}
columns={columns}
rows={rows}
placeholder={<P weight='bold'>{t('wallet.no_assets_available')}</P>}
placeholder={<P weight='bold'>{t('wallet_page.no_assets_available')}</P>}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ const StakingTable = ({ data, votingBalance }: StakingTableProps): JSX.Element =
const { getAvailableBalance } = useGetBalances();

const columns = [
{ name: t('wallet.total_governance_locked', { token: GOVERNANCE_TOKEN.ticker }), uid: StakingTableColumns.ASSET },
{
name: t('wallet_page.total_governance_locked', { token: GOVERNANCE_TOKEN.ticker }),
uid: StakingTableColumns.ASSET
},
{ name: t('unlocks'), uid: StakingTableColumns.UNLOCKS },
{ name: t('wallet.available_to_stake'), uid: StakingTableColumns.AVAILABLE },
{ name: t('wallet_page.available_to_stake'), uid: StakingTableColumns.AVAILABLE },
{
name: t('wallet.voting_power_governance', { token: VOTE_GOVERNANCE_TOKEN.ticker }),
name: t('wallet_page.voting_power_governance', { token: VOTE_GOVERNANCE_TOKEN.ticker }),
uid: StakingTableColumns.VOTING_POWER
}
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ const WelcomeBanner = ({ onClose }: WelcomeBannerProps): JSX.Element => {
<StyledTextWrapper direction='column' gap='spacing6'>
<Flex direction='column' gap='spacing4'>
<StyledTitle weight='bold' size='xl2'>
{t('wallet.welcome_to_dapp', { name: APP_NAME })}
{t('wallet_page.welcome_to_dapp', { name: APP_NAME })}
</StyledTitle>
<StyledP size='s' color='tertiary'>
{t('wallet.dapp_is_a_one_stop_shop_for_bitcoin_defi', {
{t('wallet_page.dapp_is_a_one_stop_shop_for_bitcoin_defi', {
name: APP_NAME,
wrappedToken: WRAPPED_TOKEN.ticker
})}
Expand Down
32 changes: 16 additions & 16 deletions src/parts/Sidebar/SidebarContent/Navigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,55 +69,55 @@ const Navigation = ({
const PRIMARY_NAVIGATION_ITEMS = React.useMemo(
() => [
{
name: 'nav_wallet',
name: 'navigation.wallet',
link: PAGES.WALLET,
icon: UserIcon
},
{
name: 'nav_strategies',
name: 'navigation.strategies',
link: PAGES.STRATEGIES,
icon: BanknotesIcon,
disabled: !isStrategiesEnabled
},
{
name: `nav_btc`,
name: `navigation.btc`,
link: PAGES.BTC,
icon: ArrowPathIcon,
hidden: false
},
{
name: 'nav_send_and_receive',
name: 'navigation.send_and_receive',
link: PAGES.SEND_AND_RECEIVE,
icon: ArrowsRightLeftIcon
},
{
name: 'nav_lending',
name: 'navigation.lending',
link: PAGES.LOANS,
icon: PresentationChartBarIcon
},
{
name: 'nav_swap',
name: 'navigation.swap',
link: PAGES.SWAP,
icon: ArrowPathRoundedSquareIcon
},
{
name: 'nav_pools',
name: 'navigation.pools',
link: PAGES.POOLS,
icon: Square3Stack3DIcon
},
{
name: 'nav_staking',
name: 'navigation.staking',
link: PAGES.STAKING,
icon: CircleStackIcon
},
{
name: 'nav_stats',
name: 'navigation.stats',
link: PAGES.DASHBOARD,
icon: ChartBarSquareIcon,
hidden: false
},
{
name: 'nav_vaults',
name: 'navigation.vaults',
link: `${PAGES.VAULTS.replace(`:${URL_PARAMETERS.VAULT.ACCOUNT}`, selectedAccount?.address ?? '')}`,
icon: CpuChipIcon,
hidden: !vaultClientLoaded
Expand All @@ -135,12 +135,12 @@ const Navigation = ({
const SECONDARY_NAVIGATION_ITEMS = React.useMemo(
() => [
{
name: 'nav_onboarding',
name: 'navigation.onboarding',
link: PAGES.ONBOARDING,
hidden: !isOnboardingEnabled
},
{
name: 'nav_use_wrapped',
name: 'navigation.use_wrapped',
link: USE_WRAPPED_CURRENCY_LINK,
hidden: !USE_WRAPPED_CURRENCY_LINK,
external: true,
Expand All @@ -150,7 +150,7 @@ const Navigation = ({
}
},
{
name: 'nav_crowdloan',
name: 'navigation.crowdloan',
link: CROWDLOAN_LINK,
external: true,
// This will suppress the link on testnet
Expand All @@ -161,7 +161,7 @@ const Navigation = ({
}
},
{
name: 'nav_docs',
name: 'navigation.docs',
link: INTERLAY_DOCS_LINK,
external: true,
rest: {
Expand All @@ -170,7 +170,7 @@ const Navigation = ({
}
},
{
name: 'nav_governance',
name: 'navigation.governance',
link: GOVERNANCE_LINK,
external: true,
hidden: !GOVERNANCE_LINK,
Expand All @@ -180,7 +180,7 @@ const Navigation = ({
}
},
{
name: 'nav_terms_and_conditions',
name: 'navigation.terms_and_conditions',
link: TERMS_AND_CONDITIONS_LINK,
external: true,
hidden: !TERMS_AND_CONDITIONS_LINK,
Expand Down

2 comments on commit 79ac979

@vercel
Copy link

@vercel vercel bot commented on 79ac979 Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 79ac979 Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.