From 4899d1bce8e89ce08c2b0c5cd842772703689f27 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Wed, 30 Mar 2022 18:08:25 -0700 Subject: [PATCH] Task/Mark translations (#174) * add dummy i18n translate function to market text that will need translation in future * add i18n function to aria-labels --- .../src/app/components/blocks/block-data.tsx | 13 +-- .../src/app/components/blocks/blocks-data.tsx | 7 +- .../app/components/blocks/blocks-refetch.tsx | 3 +- .../src/app/components/header/header.tsx | 3 +- .../app/components/jump-to-block/index.tsx | 5 +- .../src/app/components/jump-to/index.tsx | 3 +- .../app/components/render-fetched/index.tsx | 9 +- .../router-error-boundary/index.tsx | 3 +- .../src/app/components/search/search.tsx | 13 +-- .../src/app/components/seconds-ago/index.tsx | 10 ++- .../src/app/components/txs/block-txs-data.tsx | 7 +- .../src/app/components/txs/tx-list.tsx | 3 +- .../src/app/components/txs/txs-per-block.tsx | 9 +- apps/explorer/src/app/routes/assets/index.tsx | 3 +- .../src/app/routes/blocks/home/index.tsx | 3 +- .../src/app/routes/blocks/id/block.tsx | 5 +- .../explorer/src/app/routes/genesis/index.tsx | 3 +- .../src/app/routes/governance/index.tsx | 13 +-- .../explorer/src/app/routes/markets/index.tsx | 3 +- .../app/routes/network-parameters/index.tsx | 3 +- .../src/app/routes/parties/home/index.tsx | 7 +- .../src/app/routes/parties/id/index.tsx | 7 +- .../explorer/src/app/routes/pending/index.tsx | 5 +- .../explorer/src/app/routes/router-config.tsx | 21 ++--- .../src/app/routes/txs/home/index.tsx | 3 +- apps/explorer/src/app/routes/txs/id/index.tsx | 5 +- .../src/app/routes/txs/id/tx-content.tsx | 9 +- .../src/app/routes/txs/id/tx-details.tsx | 11 +-- .../src/app/routes/validators/index.tsx | 7 +- apps/trading/components/navbar/navbar.tsx | 5 +- .../vega-wallet-connect-button/index.tsx | 3 +- .../web3-container/web3-container.tsx | 19 +++-- apps/trading/pages/_app.page.tsx | 4 +- apps/trading/pages/index.page.tsx | 18 +--- .../trading/pages/markets/[marketId].page.tsx | 5 +- apps/trading/pages/markets/grid-tabs.tsx | 9 +- apps/trading/pages/markets/trade-grid.tsx | 27 +++--- apps/trading/pages/portfolio/index.page.tsx | 11 +-- .../deal-ticket/src/deal-ticket-container.tsx | 3 +- libs/deal-ticket/src/order-dialog.tsx | 25 +++--- libs/deal-ticket/src/submit-button.tsx | 19 +++-- .../market-list/src/lib/market-list-table.tsx | 18 ++-- libs/network-stats/src/config/stats-fields.ts | 82 ++++++++++--------- libs/order-list/src/order-list-container.tsx | 3 +- libs/order-list/src/order-list.spec.tsx | 2 +- libs/order-list/src/order-list.tsx | 6 +- .../positions/src/lib/positions-container.tsx | 3 +- libs/positions/src/lib/positions-table.tsx | 11 +-- libs/react-helpers/src/index.ts | 1 + libs/react-helpers/src/lib/i18n.ts | 1 + .../src/components/vega-logo/vega-logo.tsx | 4 +- libs/wallet/src/connect-dialog.tsx | 3 +- libs/wallet/src/provider.tsx | 4 +- libs/wallet/src/rest-connector-form.tsx | 17 ++-- libs/web3/src/lib/web3-connect-dialog.tsx | 3 +- 55 files changed, 281 insertions(+), 221 deletions(-) create mode 100644 libs/react-helpers/src/lib/i18n.ts diff --git a/apps/explorer/src/app/components/blocks/block-data.tsx b/apps/explorer/src/app/components/blocks/block-data.tsx index 2fedb94ca..0c91931c5 100644 --- a/apps/explorer/src/app/components/blocks/block-data.tsx +++ b/apps/explorer/src/app/components/blocks/block-data.tsx @@ -4,6 +4,7 @@ import { Routes } from '../../routes/router-config'; import { Link } from 'react-router-dom'; import { SecondsAgo } from '../seconds-ago'; import { Table, TableRow, TableCell } from '../table'; +import { t } from '@vegaprotocol/react-helpers'; interface BlockProps { block: BlockMeta; @@ -20,7 +21,7 @@ export const BlockData = ({ block, className }: BlockProps) => { { {block.num_txs === '1' - ? '1 transaction' - : `${block.num_txs} transactions`} + ? t('1 transaction') + : t(`${block.num_txs} transactions`)} {block.header.proposer_address} @@ -50,7 +51,7 @@ export const BlockData = ({ block, className }: BlockProps) => { diff --git a/apps/explorer/src/app/components/blocks/blocks-data.tsx b/apps/explorer/src/app/components/blocks/blocks-data.tsx index 512da0dbe..708f16f75 100644 --- a/apps/explorer/src/app/components/blocks/blocks-data.tsx +++ b/apps/explorer/src/app/components/blocks/blocks-data.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import React from 'react'; import type { TendermintBlockchainResponse } from '../../routes/blocks/tendermint-blockchain-response'; import { BlockData } from './block-data'; @@ -9,12 +10,14 @@ interface BlocksProps { export const BlocksData = ({ data, className }: BlocksProps) => { if (!data?.result) { - return
Awaiting block data
; + return
{t('Awaiting block data')}
; } return (
    {data.result?.block_metas?.map((block, index) => { diff --git a/apps/explorer/src/app/components/blocks/blocks-refetch.tsx b/apps/explorer/src/app/components/blocks/blocks-refetch.tsx index fe5ce7b7d..18e6f5177 100644 --- a/apps/explorer/src/app/components/blocks/blocks-refetch.tsx +++ b/apps/explorer/src/app/components/blocks/blocks-refetch.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import { Button } from '@vegaprotocol/ui-toolkit'; interface BlocksRefetchProps { @@ -12,7 +13,7 @@ export const BlocksRefetch = ({ refetch }: BlocksRefetchProps) => { className="mb-28" data-testid="refresh" > - Refresh to see latest blocks + {t('Refresh to see latest blocks')} ); }; diff --git a/apps/explorer/src/app/components/header/header.tsx b/apps/explorer/src/app/components/header/header.tsx index ee7f2b050..c1cd30351 100644 --- a/apps/explorer/src/app/components/header/header.tsx +++ b/apps/explorer/src/app/components/header/header.tsx @@ -1,10 +1,11 @@ +import { t } from '@vegaprotocol/react-helpers'; import { Search } from '../search'; export const Header = () => { return (

    - Vega Explorer + {t('Vega Explorer')}

    diff --git a/apps/explorer/src/app/components/jump-to-block/index.tsx b/apps/explorer/src/app/components/jump-to-block/index.tsx index 9d2f434b0..11230ff14 100644 --- a/apps/explorer/src/app/components/jump-to-block/index.tsx +++ b/apps/explorer/src/app/components/jump-to-block/index.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import React from 'react'; import { useNavigate } from 'react-router-dom'; import { Routes } from '../../routes/router-config'; @@ -22,8 +23,8 @@ export const JumpToBlock = () => { return ( diff --git a/apps/explorer/src/app/components/render-fetched/index.tsx b/apps/explorer/src/app/components/render-fetched/index.tsx index 233bc0996..cfd8a0317 100644 --- a/apps/explorer/src/app/components/render-fetched/index.tsx +++ b/apps/explorer/src/app/components/render-fetched/index.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import React from 'react'; import { StatusMessage } from '../status-message'; @@ -15,12 +16,16 @@ export const RenderFetched = ({ className, }: RenderFetchedProps) => { if (loading) { - return Loading...; + return ( + {t('Loading...')} + ); } if (error) { return ( - Error retrieving data + + {t('Error retrieving data')} + ); } diff --git a/apps/explorer/src/app/components/router-error-boundary/index.tsx b/apps/explorer/src/app/components/router-error-boundary/index.tsx index 9453c8178..0d4445114 100644 --- a/apps/explorer/src/app/components/router-error-boundary/index.tsx +++ b/apps/explorer/src/app/components/router-error-boundary/index.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import React from 'react'; interface RouteErrorBoundaryProps { @@ -23,7 +24,7 @@ export class RouteErrorBoundary extends React.Component< override render() { if (this.state.hasError) { - return

    Something went wrong

    ; + return

    {t('Something went wrong')}

    ; } return this.props.children; diff --git a/apps/explorer/src/app/components/search/search.tsx b/apps/explorer/src/app/components/search/search.tsx index adf4d9db7..f1cd3d2b7 100644 --- a/apps/explorer/src/app/components/search/search.tsx +++ b/apps/explorer/src/app/components/search/search.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import { FormGroup, Input, InputError, Button } from '@vegaprotocol/ui-toolkit'; import React from 'react'; import { useForm } from 'react-hook-form'; @@ -28,23 +29,23 @@ export const Search = () => { const search = fields.search; if (!search) { - setError(new Error('Search required')); + setError(new Error(t('Search required'))); } else if (isPrependedTransaction(search)) { if (Number.isNaN(Number(search))) { - setError(new Error('Transaction is not hexadecimal')); + setError(new Error(t('Transaction is not hexadecimal'))); } else { navigate(`${Routes.TX}/${search}`); } } else if (isTransaction(search)) { if (Number.isNaN(Number(`0x${search}`))) { - setError(new Error('Transaction is not hexadecimal')); + setError(new Error(t('Transaction is not hexadecimal'))); } else { navigate(`${Routes.TX}/0x${search}`); } } else if (isBlock(search)) { navigate(`${Routes.BLOCKS}/${Number(search)}`); } else { - setError(new Error("Something doesn't look right")); + setError(new Error(t("Something doesn't look right"))); } }, [navigate] @@ -62,7 +63,7 @@ export const Search = () => { hasError={Boolean(error?.message)} type="text" autoFocus={true} - placeholder="Enter block number or transaction hash" + placeholder={t('Enter block number or transaction hash')} /> {error?.message ? ( { )} ); diff --git a/apps/explorer/src/app/components/seconds-ago/index.tsx b/apps/explorer/src/app/components/seconds-ago/index.tsx index 965fd6024..4a1d4e732 100644 --- a/apps/explorer/src/app/components/seconds-ago/index.tsx +++ b/apps/explorer/src/app/components/seconds-ago/index.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import { useEffect, useState } from 'react'; interface SecondsAgoProps { @@ -15,15 +16,18 @@ export const SecondsAgo = ({ date, ...props }: SecondsAgoProps) => { }, [setNow]); if (!date) { - return <>Date unknown; + return <>{t('Date unknown')}; } - const timeAgoInSeconds = Math.floor((now - new Date(date).getTime()) / 1000); return (
    - {timeAgoInSeconds === 1 ? '1 second' : `${timeAgoInSeconds} seconds`} ago + {t( + `${ + timeAgoInSeconds === 1 ? '1 second' : `${timeAgoInSeconds} seconds` + } ago` + )}
    ); }; diff --git a/apps/explorer/src/app/components/txs/block-txs-data.tsx b/apps/explorer/src/app/components/txs/block-txs-data.tsx index 7ef9c1410..ebba9c589 100644 --- a/apps/explorer/src/app/components/txs/block-txs-data.tsx +++ b/apps/explorer/src/app/components/txs/block-txs-data.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import React from 'react'; import type { TendermintBlockchainResponse } from '../../routes/blocks/tendermint-blockchain-response'; import { BlockData } from '../blocks'; @@ -13,12 +14,14 @@ export const BlockTxsData = ({ data, className }: TxsProps) => { // Data for the block has already been fetched at this point, so no errors // or loading to deal with. This is specifically the case // where the data object is not undefined, but lacks a result. - return
    No data
    ; + return
    {t('No data')}
    ; } return (
      {data.result?.block_metas?.map((block, index) => { diff --git a/apps/explorer/src/app/components/txs/tx-list.tsx b/apps/explorer/src/app/components/txs/tx-list.tsx index 98f3500ca..cd55be663 100644 --- a/apps/explorer/src/app/components/txs/tx-list.tsx +++ b/apps/explorer/src/app/components/txs/tx-list.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import type { TendermintUnconfirmedTransactionsResponse } from '../../routes/txs/tendermint-unconfirmed-transactions-response.d'; interface TxsProps { @@ -6,7 +7,7 @@ interface TxsProps { export const TxList = ({ data }: TxsProps) => { if (!data) { - return
      Awaiting transactions
      ; + return
      {t('Awaiting transactions')}
      ; } return
      {JSON.stringify(data, null, ' ')}
      ; diff --git a/apps/explorer/src/app/components/txs/txs-per-block.tsx b/apps/explorer/src/app/components/txs/txs-per-block.tsx index 808d3adf4..4d04c06e3 100644 --- a/apps/explorer/src/app/components/txs/txs-per-block.tsx +++ b/apps/explorer/src/app/components/txs/txs-per-block.tsx @@ -6,6 +6,7 @@ import { Link } from 'react-router-dom'; import { RenderFetched } from '../render-fetched'; import { TruncateInline } from '../truncate/truncate'; import { TxOrderType } from './tx-order-type'; +import { t } from '@vegaprotocol/react-helpers'; interface TxsPerBlockProps { blockHeight: string | undefined; @@ -36,9 +37,9 @@ export const TxsPerBlock = ({ blockHeight }: TxsPerBlockProps) => { - - - + + + @@ -76,7 +77,7 @@ export const TxsPerBlock = ({ blockHeight }: TxsPerBlockProps) => { ) : (
      - No transactions in block {blockHeight} + {t(`No transactions in block ${blockHeight}`)}
      )} diff --git a/apps/explorer/src/app/routes/assets/index.tsx b/apps/explorer/src/app/routes/assets/index.tsx index 3fdf7f19e..8baba3d16 100644 --- a/apps/explorer/src/app/routes/assets/index.tsx +++ b/apps/explorer/src/app/routes/assets/index.tsx @@ -1,4 +1,5 @@ import { gql, useQuery } from '@apollo/client'; +import { t } from '@vegaprotocol/react-helpers'; import React from 'react'; import { RouteTitle } from '../../components/route-title'; import { SubHeading } from '../../components/sub-heading'; @@ -37,7 +38,7 @@ const Assets = () => { if (!data || !data.assets) return null; return (
      - Assets + {t('Assets')} {data?.assets.map((a) => ( diff --git a/apps/explorer/src/app/routes/blocks/home/index.tsx b/apps/explorer/src/app/routes/blocks/home/index.tsx index b6fa12635..99ec64fcc 100644 --- a/apps/explorer/src/app/routes/blocks/home/index.tsx +++ b/apps/explorer/src/app/routes/blocks/home/index.tsx @@ -5,6 +5,7 @@ import { RouteTitle } from '../../../components/route-title'; import { RenderFetched } from '../../../components/render-fetched'; import { BlocksData, BlocksRefetch } from '../../../components/blocks'; import { JumpToBlock } from '../../../components/jump-to-block'; +import { t } from '@vegaprotocol/react-helpers'; const Blocks = () => { const { @@ -16,7 +17,7 @@ const Blocks = () => { return (
      - Blocks + {t('Blocks')} <> diff --git a/apps/explorer/src/app/routes/blocks/id/block.tsx b/apps/explorer/src/app/routes/blocks/id/block.tsx index a506c20d4..cebd90612 100644 --- a/apps/explorer/src/app/routes/blocks/id/block.tsx +++ b/apps/explorer/src/app/routes/blocks/id/block.tsx @@ -15,6 +15,7 @@ import { TxsPerBlock } from '../../../components/txs/txs-per-block'; import { Button } from '@vegaprotocol/ui-toolkit'; import { Routes } from '../../router-config'; import { RenderFetched } from '../../../components/render-fetched'; +import { t } from '@vegaprotocol/react-helpers'; const Block = () => { const { block } = useParams<{ block: string }>(); @@ -26,12 +27,12 @@ const Block = () => { const header = blockData?.result.block.header; if (!header) { - return

      Could not get block data

      ; + return

      {t('Could not get block data')}

      ; } return (
      - BLOCK {block} + {t(`BLOCK ${block}`)} <>
      diff --git a/apps/explorer/src/app/routes/genesis/index.tsx b/apps/explorer/src/app/routes/genesis/index.tsx index 960087c32..1d0a46007 100644 --- a/apps/explorer/src/app/routes/genesis/index.tsx +++ b/apps/explorer/src/app/routes/genesis/index.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import { RouteTitle } from '../../components/route-title'; import { SyntaxHighlighter } from '../../components/syntax-highlighter'; import { DATA_SOURCES } from '../../config'; @@ -13,7 +14,7 @@ const Genesis = () => { if (!genesis?.result.genesis) return null; return (
      - Genesis + {t('Genesis')}
      ); diff --git a/apps/explorer/src/app/routes/governance/index.tsx b/apps/explorer/src/app/routes/governance/index.tsx index 30af1c727..cd224bb1b 100644 --- a/apps/explorer/src/app/routes/governance/index.tsx +++ b/apps/explorer/src/app/routes/governance/index.tsx @@ -1,4 +1,5 @@ import { gql, useQuery } from '@apollo/client'; +import { t } from '@vegaprotocol/react-helpers'; import React from 'react'; import { RouteTitle } from '../../components/route-title'; import { SubHeading } from '../../components/sub-heading'; @@ -10,16 +11,16 @@ import type { export function getProposalName(change: ProposalsQuery_proposals_terms_change) { if (change.__typename === 'NewAsset') { - return `New asset: ${change.symbol}`; + return t(`New asset: ${change.symbol}`); } else if (change.__typename === 'NewMarket') { - return `New market: ${change.instrument.name}`; + return t(`New market: ${change.instrument.name}`); } else if (change.__typename === 'UpdateMarket') { - return `Update market: ${change.marketId}`; + return t(`Update market: ${change.marketId}`); } else if (change.__typename === 'UpdateNetworkParameter') { - return `Update network: ${change.networkParameter.key}`; + return t(`Update network: ${change.networkParameter.key}`); } - return 'Unknown proposal'; + return t('Unknown proposal'); } const PROPOSAL_QUERY = gql` @@ -105,7 +106,7 @@ const Governance = () => { if (!data) return null; return (
      - Governance + {t('Governance')} {data.proposals?.map((p) => ( {getProposalName(p.terms.change)} diff --git a/apps/explorer/src/app/routes/markets/index.tsx b/apps/explorer/src/app/routes/markets/index.tsx index dfe1adc78..f184d4c65 100644 --- a/apps/explorer/src/app/routes/markets/index.tsx +++ b/apps/explorer/src/app/routes/markets/index.tsx @@ -5,6 +5,7 @@ import React from 'react'; import { SyntaxHighlighter } from '../../components/syntax-highlighter'; import { RouteTitle } from '../../components/route-title'; import { SubHeading } from '../../components/sub-heading'; +import { t } from '@vegaprotocol/react-helpers'; const MARKETS_QUERY = gql` query MarketsQuery { @@ -151,7 +152,7 @@ const Markets = () => { if (!data || !data.markets) return null; return (
      - Markets + {t('Markets')} {data ? data.markets.map((m) => ( diff --git a/apps/explorer/src/app/routes/network-parameters/index.tsx b/apps/explorer/src/app/routes/network-parameters/index.tsx index cf0569618..07f0cee83 100644 --- a/apps/explorer/src/app/routes/network-parameters/index.tsx +++ b/apps/explorer/src/app/routes/network-parameters/index.tsx @@ -2,6 +2,7 @@ import { gql, useQuery } from '@apollo/client'; import { RouteTitle } from '../../components/route-title'; import type { NetworkParametersQuery } from './__generated__/NetworkParametersQuery'; import { SyntaxHighlighter } from '../../components/syntax-highlighter'; +import { t } from '@vegaprotocol/react-helpers'; export const NETWORK_PARAMETERS_QUERY = gql` query NetworkParametersQuery { @@ -17,7 +18,7 @@ const NetworkParameters = () => { return (
      - Network Parameters + {t('Network Parameters')} {data ? : null}
      diff --git a/apps/explorer/src/app/routes/parties/home/index.tsx b/apps/explorer/src/app/routes/parties/home/index.tsx index 712a74aa7..74c415272 100644 --- a/apps/explorer/src/app/routes/parties/home/index.tsx +++ b/apps/explorer/src/app/routes/parties/home/index.tsx @@ -4,6 +4,7 @@ import { JumpTo } from '../../../components/jump-to'; import { useNavigate } from 'react-router-dom'; import { Routes } from '../../router-config'; +import { t } from '@vegaprotocol/react-helpers'; export const JumpToParty = () => { const navigate = useNavigate(); @@ -23,8 +24,8 @@ export const JumpToParty = () => { }; return ( { const Parties = () => { return (
      - Parties + {t('Parties')}
      ); diff --git a/apps/explorer/src/app/routes/parties/id/index.tsx b/apps/explorer/src/app/routes/parties/id/index.tsx index 809af5bc3..c0ca31e8d 100644 --- a/apps/explorer/src/app/routes/parties/id/index.tsx +++ b/apps/explorer/src/app/routes/parties/id/index.tsx @@ -1,5 +1,6 @@ import { useQuery } from '@apollo/client'; import { gql } from '@apollo/client'; +import { t } from '@vegaprotocol/react-helpers'; import React from 'react'; import { useParams } from 'react-router-dom'; import { RouteTitle } from '../../../components/route-title'; @@ -71,17 +72,17 @@ const Party = () => { return (
      - Party + {t('Party')} {data ? ( <> - Asset data + {t('Asset data')} ) : null} {partyData ? ( <> - Tendermint Data + {t('Tendermint Data')} ) : null} diff --git a/apps/explorer/src/app/routes/pending/index.tsx b/apps/explorer/src/app/routes/pending/index.tsx index 97bb5ab93..d5fd38a9e 100644 --- a/apps/explorer/src/app/routes/pending/index.tsx +++ b/apps/explorer/src/app/routes/pending/index.tsx @@ -4,6 +4,7 @@ import useFetch from '../../hooks/use-fetch'; import type { TendermintUnconfirmedTransactionsResponse } from '../txs/tendermint-unconfirmed-transactions-response.d'; import { TxList } from '../../components/txs'; import { RouteTitle } from '../../components/route-title'; +import { t } from '@vegaprotocol/react-helpers'; const PendingTxs = () => { const { @@ -15,11 +16,11 @@ const PendingTxs = () => { return (
      - Unconfirmed transactions + {t('Unconfirmed transactions')} https://lb.testnet.vega.xyz/tm/unconfirmed_txs
      -
      Number: {unconfirmedTransactions?.result?.n_txs || 0}
      +
      {t(`Number: ${unconfirmedTransactions?.result?.n_txs || 0}`)}


      diff --git a/apps/explorer/src/app/routes/router-config.tsx b/apps/explorer/src/app/routes/router-config.tsx index a67587755..cecf1a2b7 100644 --- a/apps/explorer/src/app/routes/router-config.tsx +++ b/apps/explorer/src/app/routes/router-config.tsx @@ -16,6 +16,7 @@ import { Tx } from './txs/id'; import { Txs as TxHome } from './txs/home'; import { PendingTxs } from './pending'; import flags from '../lib/flags'; +import { t } from '@vegaprotocol/react-helpers'; export const Routes = { HOME: '/', TX: 'txs', @@ -34,7 +35,7 @@ const partiesRoutes = flags.parties { path: Routes.PARTIES, name: 'Parties', - text: 'Parties', + text: t('Parties'), element: , children: [ { @@ -54,7 +55,7 @@ const assetsRoutes = flags.assets ? [ { path: Routes.ASSETS, - text: 'Assets', + text: t('Assets'), name: 'Assets', element: , }, @@ -66,7 +67,7 @@ const genesisRoutes = flags.genesis { path: Routes.GENESIS, name: 'Genesis', - text: 'Genesis Parameters', + text: t('Genesis Parameters'), element: , }, ] @@ -77,7 +78,7 @@ const governanceRoutes = flags.governance { path: Routes.GOVERNANCE, name: 'Governance', - text: 'Proposals', + text: t('Proposals'), element: , }, ] @@ -88,7 +89,7 @@ const marketsRoutes = flags.markets { path: Routes.MARKETS, name: 'Markets', - text: 'Markets', + text: t('Markets'), element: , }, ] @@ -99,7 +100,7 @@ const networkParametersRoutes = flags.networkParameters { path: Routes.NETWORK_PARAMETERS, name: 'NetworkParameters', - text: 'Network Parameters', + text: t('Network Parameters'), element: , }, ] @@ -109,7 +110,7 @@ const validators = flags.validators { path: Routes.VALIDATORS, name: 'Validators', - text: 'Validators', + text: t('Validators'), element: , }, ] @@ -119,14 +120,14 @@ const routerConfig = [ { path: Routes.HOME, name: 'Home', - text: 'Home', + text: t('Home'), element: , index: true, }, { path: Routes.TX, name: 'Txs', - text: 'Transactions', + text: t('Transactions'), element: , children: [ { @@ -146,7 +147,7 @@ const routerConfig = [ { path: Routes.BLOCKS, name: 'Blocks', - text: 'Blocks', + text: t('Blocks'), element: , children: [ { diff --git a/apps/explorer/src/app/routes/txs/home/index.tsx b/apps/explorer/src/app/routes/txs/home/index.tsx index 558fc1d34..bd83ab739 100644 --- a/apps/explorer/src/app/routes/txs/home/index.tsx +++ b/apps/explorer/src/app/routes/txs/home/index.tsx @@ -6,6 +6,7 @@ import { BlocksRefetch } from '../../../components/blocks'; import { RenderFetched } from '../../../components/render-fetched'; import { BlockTxsData } from '../../../components/txs'; import { JumpToBlock } from '../../../components/jump-to-block'; +import { t } from '@vegaprotocol/react-helpers'; const Txs = () => { const { @@ -17,7 +18,7 @@ const Txs = () => { return (
      - Transactions + {t('Transactions')} <> diff --git a/apps/explorer/src/app/routes/txs/id/index.tsx b/apps/explorer/src/app/routes/txs/id/index.tsx index 93a27887d..22798d56c 100644 --- a/apps/explorer/src/app/routes/txs/id/index.tsx +++ b/apps/explorer/src/app/routes/txs/id/index.tsx @@ -8,6 +8,7 @@ import { RouteTitle } from '../../../components/route-title'; import { RenderFetched } from '../../../components/render-fetched'; import { TxContent } from './tx-content'; import { TxDetails } from './tx-details'; +import { t } from '@vegaprotocol/react-helpers'; const Tx = () => { const { txHash } = useParams<{ txHash: string }>(); @@ -30,7 +31,7 @@ const Tx = () => { return (
      - Transaction details + {t('Transaction details')} { /> -

      Transaction content

      +

      {t('Transaction content')}

      diff --git a/apps/explorer/src/app/routes/txs/id/tx-content.tsx b/apps/explorer/src/app/routes/txs/id/tx-content.tsx index a5a194740..fdd135318 100644 --- a/apps/explorer/src/app/routes/txs/id/tx-content.tsx +++ b/apps/explorer/src/app/routes/txs/id/tx-content.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import { StatusMessage } from '../../../components/status-message'; import { SyntaxHighlighter } from '../../../components/syntax-highlighter'; import { @@ -16,7 +17,9 @@ interface TxContentProps { export const TxContent = ({ data }: TxContentProps) => { if (!data?.Command) { return ( - Could not retrieve transaction content + + {t('Could not retrieve transaction content')} + ); } @@ -25,7 +28,7 @@ export const TxContent = ({ data }: TxContentProps) => {
      TransactionFromType{t('Transaction')}{t('From')}{t('Type')}
      - Type + {t('Type')} @@ -33,7 +36,7 @@ export const TxContent = ({ data }: TxContentProps) => {
      -

      Decoded transaction content

      +

      {t('Decoded transaction content')}

      ); diff --git a/apps/explorer/src/app/routes/txs/id/tx-details.tsx b/apps/explorer/src/app/routes/txs/id/tx-details.tsx index 497d4efa1..c4008b65a 100644 --- a/apps/explorer/src/app/routes/txs/id/tx-details.tsx +++ b/apps/explorer/src/app/routes/txs/id/tx-details.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import { Link } from 'react-router-dom'; import { Table, @@ -19,20 +20,20 @@ const truncateLength = 30; export const TxDetails = ({ txData, pubKey, className }: TxDetailsProps) => { if (!txData) { - return <>Awaiting Tendermint transaction details; + return <>{t('Awaiting Tendermint transaction details')}; } return ( - Hash + {t('Hash')} {txData.hash} - Submitted by + {t('Submitted by')} { - Block + {t('Block')} { - Encoded txn + {t('Encoded txn')} { return (
      - Validators + {t('Validators')} {data ? ( <> - Vega data + {t('Vega data')} ) : null} {validators ? ( <> - Tendermint data + {t('Tendermint data')} diff --git a/apps/trading/components/navbar/navbar.tsx b/apps/trading/components/navbar/navbar.tsx index b4c87d2c1..51df59f8d 100644 --- a/apps/trading/components/navbar/navbar.tsx +++ b/apps/trading/components/navbar/navbar.tsx @@ -2,6 +2,7 @@ import { useRouter } from 'next/router'; import { Vega } from '../icons/vega'; import Link from 'next/link'; import { AnchorButton } from '@vegaprotocol/ui-toolkit'; +import { t } from '@vegaprotocol/react-helpers'; export const Navbar = () => { return ( @@ -12,8 +13,8 @@ export const Navbar = () => { {[ - { name: 'Trading', path: '/markets' }, - { name: 'Portfolio', path: '/portfolio' }, + { name: t('Trading'), path: '/markets' }, + { name: t('Portfolio'), path: '/portfolio' }, ].map((route) => ( ))} diff --git a/apps/trading/components/vega-wallet-connect-button/index.tsx b/apps/trading/components/vega-wallet-connect-button/index.tsx index 2a72e9289..1556b5441 100644 --- a/apps/trading/components/vega-wallet-connect-button/index.tsx +++ b/apps/trading/components/vega-wallet-connect-button/index.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import { useVegaWallet } from '@vegaprotocol/wallet'; interface VegaWalletButtonProps { @@ -23,7 +24,7 @@ export const VegaWalletButton = ({ onClick={handleClick} className="ml-auto inline-block text-ui sm:text-body-large" > - {isConnected ? 'Disconnect Vega wallet' : 'Connect Vega wallet'} + {isConnected ? t('Disconnect Vega wallet') : t('Connect Vega wallet')} ); }; diff --git a/apps/trading/components/web3-container/web3-container.tsx b/apps/trading/components/web3-container/web3-container.tsx index e2a48380d..a427345d8 100644 --- a/apps/trading/components/web3-container/web3-container.tsx +++ b/apps/trading/components/web3-container/web3-container.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import { Button, Splash } from '@vegaprotocol/ui-toolkit'; import { Web3Provider, Web3ConnectDialog } from '@vegaprotocol/web3'; import { useWeb3React } from '@web3-react/core'; @@ -42,8 +43,10 @@ export const Web3Content = ({ children, setDialogOpen }: Web3ContentProps) => { if (error) { return ( -

      Something went wrong: {error.message}

      - +

      {t(`Something went wrong: ${error.message}`)}

      +
      ); } @@ -51,8 +54,8 @@ export const Web3Content = ({ children, setDialogOpen }: Web3ContentProps) => { if (!isActive) { return ( -

      Connect your Ethereum wallet

      - +

      {t('Connect your Ethereum wallet')}

      +
      ); } @@ -60,8 +63,12 @@ export const Web3Content = ({ children, setDialogOpen }: Web3ContentProps) => { if (chainId !== appChainId) { return ( -

      This app only works on chain ID: {appChainId}

      - +

      + {t(`This app only works on chain ID: ${appChainId}`)} +

      +
      ); } diff --git a/apps/trading/pages/_app.page.tsx b/apps/trading/pages/_app.page.tsx index ae37cdfef..4179742ff 100644 --- a/apps/trading/pages/_app.page.tsx +++ b/apps/trading/pages/_app.page.tsx @@ -1,7 +1,7 @@ import type { AppProps } from 'next/app'; import Head from 'next/head'; import { Navbar } from '../components/navbar'; -import { ThemeContext } from '@vegaprotocol/react-helpers'; +import { t, ThemeContext } from '@vegaprotocol/react-helpers'; import { VegaConnectDialog, VegaWalletProvider } from '@vegaprotocol/wallet'; import { Connectors } from '../lib/vega-connectors'; import { useCallback, useMemo, useState } from 'react'; @@ -32,7 +32,7 @@ function VegaTradingApp({ Component, pageProps }: AppProps) { - Welcome to trading! + {t('Welcome to Vega trading!')}
      @@ -29,11 +18,6 @@ export function Index() {
      - - - - - ); } diff --git a/apps/trading/pages/markets/[marketId].page.tsx b/apps/trading/pages/markets/[marketId].page.tsx index dfd37f869..ade159a69 100644 --- a/apps/trading/pages/markets/[marketId].page.tsx +++ b/apps/trading/pages/markets/[marketId].page.tsx @@ -6,6 +6,7 @@ import React, { useEffect, useState } from 'react'; import debounce from 'lodash/debounce'; import { PageQueryContainer } from '../../components/page-query-container'; import { TradeGrid, TradePanels } from './trade-grid'; +import { t } from '@vegaprotocol/react-helpers'; // Top level page query const MARKET_QUERY = gql` @@ -29,7 +30,7 @@ const MarketPage = () => { if (!marketId) { return ( -

      Not found

      +

      {t('Not found')}

      ); } @@ -46,7 +47,7 @@ const MarketPage = () => { > {({ market }) => { if (!market) { - return Market not found; + return {t('Market not found')}; } return w > 960 ? ( diff --git a/apps/trading/pages/markets/grid-tabs.tsx b/apps/trading/pages/markets/grid-tabs.tsx index 5d7a248fc..6e554959d 100644 --- a/apps/trading/pages/markets/grid-tabs.tsx +++ b/apps/trading/pages/markets/grid-tabs.tsx @@ -19,7 +19,7 @@ export const GridTabs = ({ children, group }: GridTabsProps) => { } // Default to first tab - return children[0].props.name; + return children[0].props.id; }); // Update the query string in the url when the active tab changes @@ -45,7 +45,7 @@ export const GridTabs = ({ children, group }: GridTabsProps) => { > {Children.map(children, (child) => { if (!isValidElement(child)) return null; - const isActive = child.props.name === activeTab; + const isActive = child.props.id === activeTab; const triggerClass = classNames('py-4', 'px-12', 'capitalize', { 'text-black dark:text-vega-yellow': isActive, 'bg-white dark:bg-black': isActive, @@ -53,7 +53,7 @@ export const GridTabs = ({ children, group }: GridTabsProps) => { 'bg-black-10 dark:bg-white-10': !isActive, }); return ( - + {child.props.name} ); @@ -64,7 +64,7 @@ export const GridTabs = ({ children, group }: GridTabsProps) => { {Children.map(children, (child) => { if (!isValidElement(child)) return null; return ( - + {child.props.children} ); @@ -76,6 +76,7 @@ export const GridTabs = ({ children, group }: GridTabsProps) => { interface GridTabProps { children: ReactNode; + id: string; name: string; } diff --git a/apps/trading/pages/markets/trade-grid.tsx b/apps/trading/pages/markets/trade-grid.tsx index ce600e8b6..7f78f7c9c 100644 --- a/apps/trading/pages/markets/trade-grid.tsx +++ b/apps/trading/pages/markets/trade-grid.tsx @@ -8,25 +8,26 @@ import { OrderListContainer } from '@vegaprotocol/order-list'; import { Splash } from '@vegaprotocol/ui-toolkit'; import { PositionsContainer } from '@vegaprotocol/positions'; import type { Market_market } from './__generated__/Market'; +import { t } from '@vegaprotocol/react-helpers'; const Chart = () => ( -

      Chart

      +

      {t('Chart')}

      ); const Orderbook = () => ( -

      Orderbook

      +

      {t('Orderbook')}

      ); const Collateral = () => ( -

      Collateral

      +

      {t('Collateral')}

      ); const Trades = () => ( -

      Trades

      +

      {t('Trades')}

      ); @@ -56,7 +57,9 @@ export const TradeGrid = ({ market }: TradeGridProps) => { return (
      -

      Market: {market.name}

      +

      + {t('Market')}: {market.name} +

      @@ -66,23 +69,23 @@ export const TradeGrid = ({ market }: TradeGridProps) => { - + - + - + - + - + @@ -131,7 +134,9 @@ export const TradePanels = ({ market }: TradePanelsProps) => { return (
      -

      Market: {market.name}

      +

      + {t('Market')}: {market.name} +

      diff --git a/apps/trading/pages/portfolio/index.page.tsx b/apps/trading/pages/portfolio/index.page.tsx index 5cf191e63..eb477ed74 100644 --- a/apps/trading/pages/portfolio/index.page.tsx +++ b/apps/trading/pages/portfolio/index.page.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import { AnchorButton } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; @@ -5,14 +6,10 @@ const Portfolio = () => { const { keypair } = useVegaWallet(); return (
      -

      Portfolio

      - {keypair && ( -

      - Keypair: {keypair.name} {keypair.pub} -

      - )} +

      {t('Portfolio')}

      + {keypair &&

      {t(`Keypair: ${keypair.name} ${keypair.pub}`)}

      }
      - Deposit + {t('Deposit')}
      ); diff --git a/libs/deal-ticket/src/deal-ticket-container.tsx b/libs/deal-ticket/src/deal-ticket-container.tsx index 359f99da5..608850c24 100644 --- a/libs/deal-ticket/src/deal-ticket-container.tsx +++ b/libs/deal-ticket/src/deal-ticket-container.tsx @@ -2,6 +2,7 @@ import { AsyncRenderer, Splash } from '@vegaprotocol/ui-toolkit'; import { gql, useQuery } from '@apollo/client'; import { DealTicketManager } from './deal-ticket-manager'; import type { DealTicketQuery } from './__generated__/DealTicketQuery'; +import { t } from '@vegaprotocol/react-helpers'; const DEAL_TICKET_QUERY = gql` query DealTicketQuery($marketId: ID!) { @@ -43,7 +44,7 @@ export const DealTicketContainer = ({ marketId }: DealTicketContainerProps) => { if (!data.market) { return ( -

      Could not load market

      +

      {t('Could not load market')}

      ); } diff --git a/libs/deal-ticket/src/order-dialog.tsx b/libs/deal-ticket/src/order-dialog.tsx index aaa9e75a6..d32379be4 100644 --- a/libs/deal-ticket/src/order-dialog.tsx +++ b/libs/deal-ticket/src/order-dialog.tsx @@ -1,7 +1,7 @@ import { Icon, Loader } from '@vegaprotocol/ui-toolkit'; import type { ReactNode } from 'react'; import type { OrderEvent_busEvents_event_Order } from './__generated__/OrderEvent'; -import { formatNumber } from '@vegaprotocol/react-helpers'; +import { formatNumber, t } from '@vegaprotocol/react-helpers'; import type { TransactionState } from '@vegaprotocol/wallet'; import { VegaTxStatus } from '@vegaprotocol/wallet'; @@ -40,7 +40,7 @@ export const OrderDialog = ({ icon={} > {transaction.hash && ( -

      Tx hash: {transaction.hash}

      +

      {t(`Tx hash: ${transaction.hash}`)}

      )} ); @@ -53,7 +53,7 @@ export const OrderDialog = ({ title="Order failed" icon={} > -

      Reason: {finalizedOrder.rejectionReason}

      +

      {t(`Reason: ${finalizedOrder.rejectionReason}`)}

      ); } @@ -63,16 +63,19 @@ export const OrderDialog = ({ title="Order placed" icon={} > -

      Status: {finalizedOrder.status}

      - {finalizedOrder.market &&

      Market: {finalizedOrder.market.name}

      } -

      Type: {finalizedOrder.type}

      -

      Amount: {finalizedOrder.size}

      +

      {t(`Status: ${finalizedOrder.status}`)}

      + {finalizedOrder.market && ( +

      {t(`Market: {finalizedOrder.market.name}`)}

      + )} +

      {t(`Type: ${finalizedOrder.type}`)}

      +

      {t(`Amount: ${finalizedOrder.size}`)}

      {finalizedOrder.type === 'Limit' && finalizedOrder.market && (

      - Price:{' '} - {formatNumber( - finalizedOrder.price, - finalizedOrder.market.decimalPlaces + {t( + `Price: ${formatNumber( + finalizedOrder.price, + finalizedOrder.market.decimalPlaces + )}` )}

      )} diff --git a/libs/deal-ticket/src/submit-button.tsx b/libs/deal-ticket/src/submit-button.tsx index 83bfb90f6..88df187d0 100644 --- a/libs/deal-ticket/src/submit-button.tsx +++ b/libs/deal-ticket/src/submit-button.tsx @@ -6,6 +6,7 @@ import { useVegaWallet } from '@vegaprotocol/wallet'; import type { TransactionStatus } from './deal-ticket'; import type { DealTicketQuery_market } from './__generated__/DealTicketQuery'; import { MarketState, MarketTradingMode } from '@vegaprotocol/types'; +import { t } from '@vegaprotocol/react-helpers'; interface SubmitButtonProps { transactionStatus: TransactionStatus; @@ -22,31 +23,31 @@ export const SubmitButton = ({ const invalidText = useMemo(() => { if (!keypair) { - return 'No public key selected'; + return t('No public key selected'); } if (keypair.tainted) { - return 'Selected public key has been tainted'; + return t('Selected public key has been tainted'); } if (market.state !== MarketState.Active) { if (market.state === MarketState.Suspended) { - return 'Market is currently suspended'; + return t('Market is currently suspended'); } if ( market.state === MarketState.Proposed || market.state === MarketState.Pending ) { - return 'Market is not active yet'; + return t('Market is not active yet'); } - return 'Market is no longer active'; + return t('Market is no longer active'); } if (market.tradingMode !== MarketTradingMode.Continuous) { if (order.type === OrderType.Market) { - return 'Only limit orders are permitted when market is in auction'; + return t('Only limit orders are permitted when market is in auction'); } if ( @@ -56,7 +57,9 @@ export const SubmitButton = ({ OrderTimeInForce.GFN, ].includes(order.timeInForce) ) { - return 'Only GTT, GTC and GFA are permitted when market is in auction'; + return t( + 'Only GTT, GTC and GFA are permitted when market is in auction' + ); } } @@ -73,7 +76,7 @@ export const SubmitButton = ({ type="submit" disabled={disabled} > - {transactionStatus === 'pending' ? 'Pending...' : 'Place order'} + {transactionStatus === 'pending' ? t('Pending...') : t('Place order')} {invalidText && {invalidText}} diff --git a/libs/market-list/src/lib/market-list-table.tsx b/libs/market-list/src/lib/market-list-table.tsx index 1c537d0d6..944543cb3 100644 --- a/libs/market-list/src/lib/market-list-table.tsx +++ b/libs/market-list/src/lib/market-list-table.tsx @@ -1,6 +1,6 @@ import { forwardRef } from 'react'; import type { ValueFormatterParams } from 'ag-grid-community'; -import { PriceCell, formatNumber } from '@vegaprotocol/react-helpers'; +import { PriceCell, formatNumber, t } from '@vegaprotocol/react-helpers'; import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit'; import type { Markets_markets } from './__generated__/Markets'; import { AgGridColumn } from 'ag-grid-react'; @@ -18,7 +18,7 @@ export const MarketListTable = forwardRef( return ( ( components={{ PriceCell }} > `${value.market.state} (${value.market.tradingMode})` } /> ( } /> @@ -65,7 +65,7 @@ export const MarketListTable = forwardRef( cellRenderer="PriceCell" /> ( formatNumber(value, data.decimalPlaces) } /> - + ); } diff --git a/libs/network-stats/src/config/stats-fields.ts b/libs/network-stats/src/config/stats-fields.ts index 8a10a5430..ada886fcf 100644 --- a/libs/network-stats/src/config/stats-fields.ts +++ b/libs/network-stats/src/config/stats-fields.ts @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import type { Stats as IStats, StatFields as IStatFields } from './types'; // Stats fields config. Keys will correspond to graphql queries when used, and values @@ -6,7 +7,7 @@ import type { Stats as IStats, StatFields as IStatFields } from './types'; export const statsFields: { [key in keyof IStats]: IStatFields[] } = { status: [ { - title: 'Status', + title: t('Status'), formatter: (status: string) => { if (!status) { return; @@ -22,123 +23,126 @@ export const statsFields: { [key in keyof IStats]: IStatFields[] } = { goodThreshold: (status: string) => status === 'CONNECTED' || status === 'CHAIN_STATUS_CONNECTED', promoted: true, - description: - 'Status is either connected, replaying, unspecified or disconnected', + description: t( + 'Status is either connected, replaying, unspecified or disconnected' + ), }, ], blockHeight: [ { - title: 'Height', + title: t('Height'), goodThreshold: (height: number) => height >= 60, promoted: true, - description: 'Block height', + description: t('Block height'), }, ], totalNodes: [ { - title: 'Total nodes', - description: 'The total number of nodes registered on the network', + title: t('Total nodes'), + description: t('The total number of nodes registered on the network'), }, ], validatingNodes: [ { - title: 'Validating nodes', + title: t('Validating nodes'), promoted: true, - description: 'Nodes participating in consensus', + description: t('Nodes participating in consensus'), }, ], inactiveNodes: [ { - title: 'Inactive nodes', + title: t('Inactive nodes'), goodThreshold: (totalInactive: number) => totalInactive < 1, - description: 'Nodes that are registered but not validating', + description: t('Nodes that are registered but not validating'), }, ], stakedTotal: [ { - title: 'Total staked', + title: t('Total staked'), formatter: (total: string) => total.length > 18 && parseInt(total.substring(0, total.length - 18)).toLocaleString('en-US'), - description: 'Sum of VEGA associated with a Vega key', + description: t('Sum of VEGA associated with a Vega key'), }, ], backlogLength: [ { - title: 'Backlog', + title: t('Backlog'), goodThreshold: (length: number, blockDuration: number) => { return ( length < 1000 || (length >= 1000 && blockDuration / 1000000000 <= 1) ); }, - description: 'Number of transactions waiting to be processed', + description: t('Number of transactions waiting to be processed'), }, ], tradesPerSecond: [ { - title: 'Trades / second', + title: t('Trades / second'), goodThreshold: (trades: number) => trades >= 2, - description: 'Number of trades processed in the last second', + description: t('Number of trades processed in the last second'), }, ], averageOrdersPerBlock: [ { - title: 'Orders / block', + title: t('Orders / block'), goodThreshold: (orders: number) => orders >= 2, - description: - 'Number of new orders processed in the last block. All pegged orders and liquidity provisions count as a single order', + description: t( + 'Number of new orders processed in the last block. All pegged orders and liquidity provisions count as a single order' + ), }, ], ordersPerSecond: [ { - title: 'Orders / second', + title: t('Orders / second'), goodThreshold: (orders: number) => orders >= 2, - description: - 'Number of orders processed in the last second. All pegged orders and liquidity provisions count as a single order', + description: t( + 'Number of orders processed in the last second. All pegged orders and liquidity provisions count as a single order' + ), }, ], txPerBlock: [ { - title: 'Transactions / block', + title: t('Transactions / block'), goodThreshold: (tx: number) => tx > 2, - description: 'Number of transactions processed in the last block', + description: t('Number of transactions processed in the last block'), }, ], blockDuration: [ { - title: 'Block time', + title: t('Block time'), formatter: (duration: number) => (duration / 1000000000).toFixed(3), goodThreshold: (blockDuration: number) => blockDuration > 0 && blockDuration <= 2000000000, - description: 'Seconds between the two most recent blocks', + description: t('Seconds between the two most recent blocks'), }, ], vegaTime: [ { - title: 'Time', + title: t('Time'), formatter: (time: Date) => new Date(time).toLocaleTimeString(), goodThreshold: (time: Date) => { const diff = new Date().getTime() - new Date(time).getTime(); return diff > 0 && diff < 5000; }, - description: 'The time on the blockchain', + description: t('The time on the blockchain'), }, ], appVersion: [ { - title: 'App', - description: 'Vega node software version on this node', + title: t('App'), + description: t('Vega node software version on this node'), }, ], chainVersion: [ { - title: 'Tendermint', - description: 'Tendermint software version on this node', + title: t('Tendermint'), + description: t('Tendermint software version on this node'), }, ], uptime: [ { - title: 'Uptime', + title: t('Uptime'), formatter: (t: string) => { if (!t) { return; @@ -152,23 +156,23 @@ export const statsFields: { [key in keyof IStats]: IStatFields[] } = { return `${days}d ${hours}h ${mins}m ${secs}s`; }, promoted: true, - description: 'Time since genesis', + description: t('Time since genesis'), }, { - title: 'Up since', + title: t('Up since'), formatter: (t: string) => { if (!t) { return; } return `${new Date(t).toLocaleString().replace(',', ' ')}`; }, - description: 'Genesis', + description: t('Genesis'), }, ], chainId: [ { - title: 'Chain ID', - description: 'Identifier', + title: t('Chain ID'), + description: t('Identifier'), }, ], }; diff --git a/libs/order-list/src/order-list-container.tsx b/libs/order-list/src/order-list-container.tsx index f4c608530..32b0aafba 100644 --- a/libs/order-list/src/order-list-container.tsx +++ b/libs/order-list/src/order-list-container.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import { Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { OrderListManager } from './order-list-manager'; @@ -6,7 +7,7 @@ export const OrderListContainer = () => { const { keypair } = useVegaWallet(); if (!keypair) { - return Please connect Vega wallet; + return {t('Please connect Vega wallet')}; } return ; diff --git a/libs/order-list/src/order-list.spec.tsx b/libs/order-list/src/order-list.spec.tsx index 40b3e23f6..eb9b5bb4a 100644 --- a/libs/order-list/src/order-list.spec.tsx +++ b/libs/order-list/src/order-list.spec.tsx @@ -87,7 +87,7 @@ test('Correct columns are rendered', async () => { 'Amount', 'Type', 'Status', - 'Filled', + 'Remaining', 'Price', 'Time In Force', 'Created At', diff --git a/libs/order-list/src/order-list.tsx b/libs/order-list/src/order-list.tsx index b1b0ada31..c48f10cd8 100644 --- a/libs/order-list/src/order-list.tsx +++ b/libs/order-list/src/order-list.tsx @@ -3,6 +3,7 @@ import type { Orders_party_orders } from './__generated__/Orders'; import { formatNumber, getDateTimeFormat, + t, useApplyGridTransaction, } from '@vegaprotocol/react-helpers'; import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit'; @@ -33,11 +34,11 @@ export const OrderList = ({ orders }: OrderListProps) => { getRowNodeId={(data) => data.id} > { @@ -57,7 +58,6 @@ export const OrderList = ({ orders }: OrderListProps) => { }} /> { diff --git a/libs/positions/src/lib/positions-container.tsx b/libs/positions/src/lib/positions-container.tsx index 6322f6929..7eec41287 100644 --- a/libs/positions/src/lib/positions-container.tsx +++ b/libs/positions/src/lib/positions-container.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import { Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { PositionsManager } from './positions-manager'; @@ -8,7 +9,7 @@ export const PositionsContainer = () => { if (!keypair) { return ( -

      Please connect Vega wallet

      +

      {t('Please connect Vega wallet')}

      ); } diff --git a/libs/positions/src/lib/positions-table.tsx b/libs/positions/src/lib/positions-table.tsx index 01e2cad8a..304826de9 100644 --- a/libs/positions/src/lib/positions-table.tsx +++ b/libs/positions/src/lib/positions-table.tsx @@ -5,6 +5,7 @@ import { formatNumber, volumePrefix, addDecimal, + t, } from '@vegaprotocol/react-helpers'; import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit'; import { AgGridColumn } from 'ag-grid-react'; @@ -64,18 +65,18 @@ export const PositionsTable = forwardRef( components={{ PriceCell }} > volumePrefix(value) } /> ( } /> ( }} /> str; diff --git a/libs/ui-toolkit/src/components/vega-logo/vega-logo.tsx b/libs/ui-toolkit/src/components/vega-logo/vega-logo.tsx index 4545b46b8..7476cd470 100644 --- a/libs/ui-toolkit/src/components/vega-logo/vega-logo.tsx +++ b/libs/ui-toolkit/src/components/vega-logo/vega-logo.tsx @@ -1,7 +1,9 @@ +import { t } from '@vegaprotocol/react-helpers'; + export const VegaLogo = () => { return ( setSelectedConnector(connector)} className="capitalize hover:text-vega-pink dark:hover:text-vega-yellow underline" > - {key} provider + {t(`${key} provider`)}

      {connector.description}

      diff --git a/libs/wallet/src/provider.tsx b/libs/wallet/src/provider.tsx index 0fe2b2840..ad281014a 100644 --- a/libs/wallet/src/provider.tsx +++ b/libs/wallet/src/provider.tsx @@ -1,4 +1,4 @@ -import { LocalStorage } from '@vegaprotocol/react-helpers'; +import { LocalStorage, t } from '@vegaprotocol/react-helpers'; import type { ReactNode } from 'react'; import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import type { VegaKeyExtended, VegaWalletContextShape } from '.'; @@ -38,7 +38,7 @@ export const VegaWalletProvider = ({ children }: VegaWalletProviderProps) => { const nameMeta = pk.meta?.find((m) => m.key === 'name'); return { ...pk, - name: nameMeta?.value ? nameMeta.value : 'None', + name: nameMeta?.value ? nameMeta.value : t('None'), }; }); diff --git a/libs/wallet/src/rest-connector-form.tsx b/libs/wallet/src/rest-connector-form.tsx index e0d220860..6173a55a5 100644 --- a/libs/wallet/src/rest-connector-form.tsx +++ b/libs/wallet/src/rest-connector-form.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import { Button, FormGroup, Input, InputError } from '@vegaprotocol/ui-toolkit'; import { useState } from 'react'; import { useForm } from 'react-hook-form'; @@ -40,20 +41,20 @@ export function RestConnectorForm({ } } catch (err) { if (err instanceof TypeError) { - setError('Wallet not running at http://localhost:1789'); + setError(t('Wallet not running at http://localhost:1789')); } else if (err instanceof Error) { - setError('Authentication failed'); + setError(t('Authentication failed')); } else { - setError('Something went wrong'); + setError(t('Something went wrong')); } } } return (
      - + )} - + @@ -82,7 +83,7 @@ export function RestConnectorForm({

      )} ); diff --git a/libs/web3/src/lib/web3-connect-dialog.tsx b/libs/web3/src/lib/web3-connect-dialog.tsx index 878d5c370..039deb4c6 100644 --- a/libs/web3/src/lib/web3-connect-dialog.tsx +++ b/libs/web3/src/lib/web3-connect-dialog.tsx @@ -1,3 +1,4 @@ +import { t } from '@vegaprotocol/react-helpers'; import { Dialog, Intent } from '@vegaprotocol/ui-toolkit'; import type { Connectors } from './types'; @@ -19,7 +20,7 @@ export const Web3ConnectDialog = ({ open={dialogOpen} onChange={setDialogOpen} intent={Intent.Prompt} - title="Connect to your Ethereum wallet" + title={t('Connect to your Ethereum wallet')} >
        {Object.entries(connectors).map(([connectorName, [connector]]) => {