Commit 9831cda2 authored by Moody Salem's avatar Moody Salem

more i18n for errors

parent 62d4bb8b
import { t } from '@lingui/macro'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { Token, Currency, Percent, CurrencyAmount } from '@uniswap/sdk-core' import { Token, Currency, Percent, CurrencyAmount } from '@uniswap/sdk-core'
import { Pair } from '@uniswap/v2-sdk' import { Pair } from '@uniswap/v2-sdk'
...@@ -123,11 +124,11 @@ export function useDerivedBurnInfo( ...@@ -123,11 +124,11 @@ export function useDerivedBurnInfo(
let error: string | undefined let error: string | undefined
if (!account) { if (!account) {
error = 'Connect Wallet' error = t`Connect Wallet`
} }
if (!parsedAmounts[Field.LIQUIDITY] || !parsedAmounts[Field.CURRENCY_A] || !parsedAmounts[Field.CURRENCY_B]) { if (!parsedAmounts[Field.LIQUIDITY] || !parsedAmounts[Field.CURRENCY_A] || !parsedAmounts[Field.CURRENCY_B]) {
error = error ?? 'Enter an amount' error = error ?? t`Enter an amount`
} }
return { pair, parsedAmounts, error } return { pair, parsedAmounts, error }
......
import { t } from '@lingui/macro'
import { useCallback, useMemo } from 'react' import { useCallback, useMemo } from 'react'
import { useDispatch, useSelector } from 'react-redux' import { useDispatch, useSelector } from 'react-redux'
import { AppDispatch, AppState } from '../index' import { AppDispatch, AppState } from '../index'
...@@ -177,25 +178,25 @@ export function useDerivedMintInfo( ...@@ -177,25 +178,25 @@ export function useDerivedMintInfo(
let error: string | undefined let error: string | undefined
if (!account) { if (!account) {
error = 'Connect Wallet' error = t`Connect Wallet`
} }
if (pairState === PairState.INVALID) { if (pairState === PairState.INVALID) {
error = error ?? 'Invalid pair' error = error ?? t`Invalid pair`
} }
if (!parsedAmounts[Field.CURRENCY_A] || !parsedAmounts[Field.CURRENCY_B]) { if (!parsedAmounts[Field.CURRENCY_A] || !parsedAmounts[Field.CURRENCY_B]) {
error = error ?? 'Enter an amount' error = error ?? t`Enter an amount`
} }
const { [Field.CURRENCY_A]: currencyAAmount, [Field.CURRENCY_B]: currencyBAmount } = parsedAmounts const { [Field.CURRENCY_A]: currencyAAmount, [Field.CURRENCY_B]: currencyBAmount } = parsedAmounts
if (currencyAAmount && currencyBalances?.[Field.CURRENCY_A]?.lessThan(currencyAAmount)) { if (currencyAAmount && currencyBalances?.[Field.CURRENCY_A]?.lessThan(currencyAAmount)) {
error = 'Insufficient ' + currencies[Field.CURRENCY_A]?.symbol + ' balance' error = t`Insufficient ${currencies[Field.CURRENCY_A]?.symbol} balance`
} }
if (currencyBAmount && currencyBalances?.[Field.CURRENCY_B]?.lessThan(currencyBAmount)) { if (currencyBAmount && currencyBalances?.[Field.CURRENCY_B]?.lessThan(currencyBAmount)) {
error = 'Insufficient ' + currencies[Field.CURRENCY_B]?.symbol + ' balance' error = t`Insufficient ${currencies[Field.CURRENCY_B]?.symbol} balance`
} }
return { return {
......
import { t } from '@lingui/macro'
import { BIG_INT_ZERO } from '../../../constants/misc' import { BIG_INT_ZERO } from '../../../constants/misc'
import { getTickToPrice } from 'utils/getTickToPrice' import { getTickToPrice } from 'utils/getTickToPrice'
import JSBI from 'jsbi' import JSBI from 'jsbi'
...@@ -378,32 +379,32 @@ export function useV3DerivedMintInfo( ...@@ -378,32 +379,32 @@ export function useV3DerivedMintInfo(
let errorMessage: string | undefined let errorMessage: string | undefined
if (!account) { if (!account) {
errorMessage = 'Connect Wallet' errorMessage = t`Connect Wallet`
} }
if (poolState === PoolState.INVALID) { if (poolState === PoolState.INVALID) {
errorMessage = errorMessage ?? 'Invalid pair' errorMessage = errorMessage ?? t`Invalid pair`
} }
if (invalidPrice) { if (invalidPrice) {
errorMessage = errorMessage ?? 'Invalid price input' errorMessage = errorMessage ?? t`Invalid price input`
} }
if ( if (
(!parsedAmounts[Field.CURRENCY_A] && !depositADisabled) || (!parsedAmounts[Field.CURRENCY_A] && !depositADisabled) ||
(!parsedAmounts[Field.CURRENCY_B] && !depositBDisabled) (!parsedAmounts[Field.CURRENCY_B] && !depositBDisabled)
) { ) {
errorMessage = errorMessage ?? 'Enter an amount' errorMessage = errorMessage ?? t`Enter an amount`
} }
const { [Field.CURRENCY_A]: currencyAAmount, [Field.CURRENCY_B]: currencyBAmount } = parsedAmounts const { [Field.CURRENCY_A]: currencyAAmount, [Field.CURRENCY_B]: currencyBAmount } = parsedAmounts
if (currencyAAmount && currencyBalances?.[Field.CURRENCY_A]?.lessThan(currencyAAmount)) { if (currencyAAmount && currencyBalances?.[Field.CURRENCY_A]?.lessThan(currencyAAmount)) {
errorMessage = 'Insufficient ' + currencies[Field.CURRENCY_A]?.symbol + ' balance' errorMessage = t`Insufficient ${currencies[Field.CURRENCY_A]?.symbol} balance`
} }
if (currencyBAmount && currencyBalances?.[Field.CURRENCY_B]?.lessThan(currencyBAmount)) { if (currencyBAmount && currencyBalances?.[Field.CURRENCY_B]?.lessThan(currencyBAmount)) {
errorMessage = 'Insufficient ' + currencies[Field.CURRENCY_B]?.symbol + ' balance' errorMessage = t`Insufficient ${currencies[Field.CURRENCY_B]?.symbol} balance`
} }
const invalidPool = poolState === PoolState.INVALID const invalidPool = poolState === PoolState.INVALID
......
import { t } from '@lingui/macro'
import { Token, CurrencyAmount, WETH9 } from '@uniswap/sdk-core' import { Token, CurrencyAmount, WETH9 } from '@uniswap/sdk-core'
import { Pair } from '@uniswap/v2-sdk' import { Pair } from '@uniswap/v2-sdk'
import JSBI from 'jsbi' import JSBI from 'jsbi'
...@@ -261,10 +262,10 @@ export function useDerivedStakeInfo( ...@@ -261,10 +262,10 @@ export function useDerivedStakeInfo(
let error: string | undefined let error: string | undefined
if (!account) { if (!account) {
error = 'Connect Wallet' error = t`Connect Wallet`
} }
if (!parsedAmount) { if (!parsedAmount) {
error = error ?? 'Enter an amount' error = error ?? t`Enter an amount`
} }
return { return {
...@@ -290,10 +291,10 @@ export function useDerivedUnstakeInfo( ...@@ -290,10 +291,10 @@ export function useDerivedUnstakeInfo(
let error: string | undefined let error: string | undefined
if (!account) { if (!account) {
error = 'Connect Wallet' error = t`Connect Wallet`
} }
if (!parsedAmount) { if (!parsedAmount) {
error = error ?? 'Enter an amount' error = error ?? t`Enter an amount`
} }
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