1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-27 10:48:22 +00:00

Merge pull request #539 from trezor/feature/l10n-moar

Feature/l10n moar
This commit is contained in:
Vladimir Volek 2019-05-13 12:47:03 +02:00 committed by GitHub
commit 8440daebe7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
88 changed files with 643 additions and 244 deletions

View File

@ -1,5 +1,6 @@
/* @flow */
import React from 'react';
import { FormattedMessage } from 'react-intl';
import TrezorConnect, { UI } from 'trezor-connect';
import * as BLOCKCHAIN_ACTION from 'actions/constants/blockchain';
import * as DISCOVERY from 'actions/constants/discovery';
@ -17,6 +18,8 @@ import type {
Account,
} from 'flowtype';
import type { Discovery, State } from 'reducers/DiscoveryReducer';
import l10nMessages from 'components/notifications/Context/actions.messages';
import l10nCommonMessages from 'views/common.messages';
import * as BlockchainActions from './BlockchainActions';
import * as EthereumDiscoveryActions from './ethereum/DiscoveryActions';
import * as RippleDiscoveryActions from './ripple/DiscoveryActions';
@ -176,12 +179,12 @@ const begin = (device: TrezorDevice, networkName: string): AsyncAction => async
type: NOTIFICATION.ADD,
payload: {
variant: 'error',
title: 'Discovery error',
title: <FormattedMessage {...l10nMessages.TR_ACCOUNT_DISCOVERY_ERROR} />,
message: error.message,
cancelable: true,
actions: [
{
label: 'Try again',
label: <FormattedMessage {...l10nCommonMessages.TR_TRY_AGAIN} />,
callback: () => {
dispatch(start(device, networkName));
},
@ -264,12 +267,12 @@ const discoverAccount = (device: TrezorDevice, discoveryProcess: Discovery): Asy
type: NOTIFICATION.ADD,
payload: {
variant: 'error',
title: 'Account discovery error',
title: <FormattedMessage {...l10nMessages.TR_ACCOUNT_DISCOVERY_ERROR} />,
message: error.message,
cancelable: true,
actions: [
{
label: 'Try again',
label: <FormattedMessage {...l10nCommonMessages.TR_TRY_AGAIN} />,
callback: () => {
dispatch(start(device, discoveryProcess.network));
},

View File

@ -2,7 +2,14 @@
import * as React from 'react';
import * as NOTIFICATION from 'actions/constants/notification';
import type { Action, AsyncAction, GetState, Dispatch, RouterLocationState } from 'flowtype';
import type {
Action,
AsyncAction,
GetState,
Dispatch,
RouterLocationState,
MessageDescriptor,
} from 'flowtype';
import type { CallbackAction } from 'reducers/NotificationReducer';
export type NotificationAction =
@ -10,7 +17,7 @@ export type NotificationAction =
type: typeof NOTIFICATION.ADD,
payload: {
+variant: string,
+title: React.Node | string,
+title: React.Node | MessageDescriptor | string,
+message?: ?(React.Node | string),
+cancelable: boolean,
actions?: Array<CallbackAction>,

View File

@ -1,5 +1,6 @@
/* @flow */
import React from 'react';
import { FormattedMessage } from 'react-intl';
import TrezorConnect from 'trezor-connect';
import * as RECEIVE from 'actions/constants/receive';
import * as NOTIFICATION from 'actions/constants/notification';
@ -8,6 +9,8 @@ import { initialState } from 'reducers/ReceiveReducer';
import type { State } from 'reducers/ReceiveReducer';
import type { TrezorDevice, ThunkAction, AsyncAction, Action, GetState, Dispatch } from 'flowtype';
import l10nMessages from 'components/notifications/Context/actions.messages';
import l10nCommonMessages from 'views/common.messages';
export type ReceiveAction =
| {
@ -112,12 +115,12 @@ export const showAddress = (path: Array<number>): AsyncAction => async (
type: NOTIFICATION.ADD,
payload: {
variant: 'error',
title: 'Verifying address error',
title: <FormattedMessage {...l10nMessages.TR_VERIFYING_ADDRESS_ERROR} />,
message: response.payload.error,
cancelable: true,
actions: [
{
label: 'Try again',
label: <FormattedMessage {...l10nCommonMessages.TR_TRY_AGAIN} />,
callback: () => {
dispatch(showAddress(path));
},

View File

@ -1,8 +1,11 @@
/* @flow */
import React from 'react';
import { FormattedMessage } from 'react-intl';
import TrezorConnect from 'trezor-connect';
import type { GetState, Dispatch, ThunkAction, AsyncAction } from 'flowtype';
import { validateAddress } from 'utils/ethUtils';
import * as NOTIFICATION from 'actions/constants/notification';
import l10nMessages from 'components/notifications/Context/actions.messages';
import * as SIGN_VERIFY from './constants/signVerify';
export type SignVerifyAction =
@ -65,7 +68,7 @@ const sign = (path: Array<number>, message: string, hex: boolean = false): Async
type: NOTIFICATION.ADD,
payload: {
variant: 'error',
title: 'Sign error',
title: <FormattedMessage {...l10nMessages.TR_SIGN_MESSAGE_ERROR} />,
message: response.payload.error,
cancelable: true,
},
@ -110,8 +113,8 @@ const verify = (
type: NOTIFICATION.ADD,
payload: {
variant: 'success',
title: 'Verify success',
message: 'signature is valid',
title: <FormattedMessage {...l10nMessages.TR_VERIFY_MESSAGE_SUCCESS} />,
message: <FormattedMessage {...l10nMessages.TR_SIGNATURE_IS_VALID} />,
cancelable: true,
},
});
@ -120,7 +123,7 @@ const verify = (
type: NOTIFICATION.ADD,
payload: {
variant: 'error',
title: 'Verify error',
title: <FormattedMessage {...l10nMessages.TR_VERIFY_MESSAGE_ERROR} />,
message: response.payload.error,
cancelable: true,
},

View File

@ -6,6 +6,8 @@ import TrezorConnect, {
TRANSPORT_EVENT,
BLOCKCHAIN_EVENT,
} from 'trezor-connect';
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { CONTEXT_NONE } from 'actions/constants/modal';
import urlConstants from 'constants/urls';
import * as CONNECT from 'actions/constants/TrezorConnect';
@ -35,6 +37,9 @@ import type {
TrezorDevice,
} from 'flowtype';
import l10nCommonMessages from 'views/common.messages';
import l10nMessages from 'components/notifications/Context/actions.messages';
export type TrezorConnectAction =
| {
type: typeof CONNECT.INITIALIZATION_ERROR,
@ -264,12 +269,12 @@ export const authorizeDevice = (): AsyncAction => async (
payload: {
devicePath: selected.path,
variant: 'error',
title: 'Authentication error',
title: <FormattedMessage {...l10nMessages.TR_AUTHENTICATION_ERROR} />,
message: response.payload.error,
cancelable: false,
actions: [
{
label: 'Try again',
label: <FormattedMessage {...l10nCommonMessages.TR_TRY_AGAIN} />,
callback: () => {
dispatch({
type: NOTIFICATION.CLOSE,
@ -351,7 +356,7 @@ export function acquire(): AsyncAction {
payload: {
type: 'error',
variant: 'error',
title: 'Acquire device error',
title: <FormattedMessage {...l10nMessages.TR_ACQUIRE_DEVICE_ERROR} />,
message: response.payload.error,
cancelable: true,
// actions: [

View File

@ -1,5 +1,6 @@
/* @flow */
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { Link } from 'trezor-ui-components';
import TrezorConnect from 'trezor-connect';
import BigNumber from 'bignumber.js';
@ -23,10 +24,10 @@ import type {
TrezorDevice,
} from 'flowtype';
import type { State, FeeLevel } from 'reducers/SendFormEthereumReducer';
import l10nMessages from 'components/notifications/Context/actions.messages';
import * as SessionStorageActions from '../SessionStorageActions';
import { prepareEthereumTx, serializeEthereumTx } from '../TxActions';
import * as BlockchainActions from './BlockchainActions';
import * as ValidationActions from './SendFormValidationActions';
// list of all actions which has influence on "sendFormEthereum" reducer
@ -717,7 +718,7 @@ export const onSend = (): AsyncAction => async (
type: NOTIFICATION.ADD,
payload: {
variant: 'error',
title: 'Transaction error',
title: <FormattedMessage {...l10nMessages.TR_TRANSACTION_ERROR} />,
message: signedTransaction.payload.error,
cancelable: true,
actions: [],
@ -807,10 +808,10 @@ export const onSend = (): AsyncAction => async (
type: NOTIFICATION.ADD,
payload: {
variant: 'success',
title: 'Transaction success',
title: <FormattedMessage {...l10nMessages.TR_TRANSACTION_SUCCESS} />,
message: (
<Link href={`${network.explorer.tx}${txid}`} isGreen>
See transaction detail
<FormattedMessage {...l10nMessages.TR_SEE_TRANSACTION_DETAILS} />
</Link>
),
cancelable: true,
@ -822,7 +823,7 @@ export const onSend = (): AsyncAction => async (
type: NOTIFICATION.ADD,
payload: {
variant: 'error',
title: 'Transaction error',
title: <FormattedMessage {...l10nMessages.TR_TRANSACTION_ERROR} />,
message: error.message || error,
cancelable: true,
actions: [],

View File

@ -11,6 +11,8 @@ import * as validators from 'utils/validators';
import type { Dispatch, GetState, PayloadAction } from 'flowtype';
import type { State, FeeLevel } from 'reducers/SendFormEthereumReducer';
import l10nMessages from 'views/Wallet/views/Account/Send/validation.messages';
import l10nCommonMessages from 'views/common.messages';
/*
* Called from SendFormActions.observe
@ -150,14 +152,14 @@ export const addressValidation = ($state: State): PayloadAction<State> => (): St
const { address } = state;
if (address.length < 1) {
state.errors.address = 'Address is not set';
state.errors.address = l10nMessages.TR_ADDRESS_IS_NOT_SET;
} else if (!EthereumjsUtil.isValidAddress(address)) {
state.errors.address = 'Address is not valid';
state.errors.address = l10nMessages.TR_ADDRESS_IS_NOT_VALID;
} else if (
validators.hasUppercase(address) &&
!EthereumjsUtil.isValidChecksumAddress(address)
) {
state.errors.address = 'Address is not a valid checksum';
state.errors.address = l10nMessages.TR_ADDRESS_CHECKSUM_IS_NOT_VALID;
}
return state;
};
@ -189,9 +191,13 @@ export const addressLabel = ($state: State): PayloadAction<State> => (
currentNetworkAccount.deviceState
);
if (device) {
state.infos.address = `${
device.instanceLabel
} Account #${currentNetworkAccount.index + 1}`;
state.infos.address = {
...l10nCommonMessages.TR_DEVICE_LABEL_ACCOUNT_HASH,
values: {
deviceLabel: device.instanceLabel,
number: currentNetworkAccount.index + 1,
},
};
}
} else {
// corner-case: the same derivation path is used on different networks
@ -204,11 +210,14 @@ export const addressLabel = ($state: State): PayloadAction<State> => (
const { networks } = getState().localStorage.config;
const otherNetwork = networks.find(c => c.shortcut === otherNetworkAccount.network);
if (device && otherNetwork) {
state.warnings.address = `Looks like it's ${
device.instanceLabel
} Account #${otherNetworkAccount.index + 1} address of ${
otherNetwork.name
} network`;
state.warnings.address = {
...l10nCommonMessages.TR_LOOKS_LIKE_IT_IS_DEVICE_LABEL,
values: {
deviceLabel: device.instanceLabel,
number: otherNetworkAccount.index + 1,
network: otherNetwork.name,
},
};
}
}
}
@ -231,9 +240,9 @@ export const amountValidation = ($state: State): PayloadAction<State> => (
const { amount } = state;
if (amount.length < 1) {
state.errors.amount = 'Amount is not set';
state.errors.amount = l10nMessages.TR_AMOUNT_IS_NOT_SET;
} else if (amount.length > 0 && !validators.isNumber(amount)) {
state.errors.amount = 'Amount is not a number';
state.errors.amount = l10nMessages.TR_AMOUNT_IS_NOT_A_NUMBER;
} else {
const isToken: boolean = state.currency !== state.networkSymbol;
const pendingAmount: BigNumber = getPendingAmount(pending, state.currency, isToken);
@ -248,26 +257,40 @@ export const amountValidation = ($state: State): PayloadAction<State> => (
if (!token) return state;
if (!validators.hasDecimals(state.amount, parseInt(token.decimals, 0))) {
state.errors.amount = `Maximum ${token.decimals} decimals allowed`;
state.errors.amount = {
...l10nMessages.TR_MAXIMUM_DECIMALS_ALLOWED,
values: { decimals: token.decimals },
};
} else if (new BigNumber(state.total).isGreaterThan(account.balance)) {
state.errors.amount = `Not enough ${state.networkSymbol} to cover transaction fee`;
state.errors.amount = {
...l10nMessages.TR_NOT_ENOUGH_FUNDS_TO_COVER_TRANSACTION,
values: {
networkSymbol: state.networkSymbol,
},
};
} else if (
new BigNumber(state.amount).isGreaterThan(
new BigNumber(token.balance).minus(pendingAmount)
)
) {
state.errors.amount = 'Not enough funds';
state.errors.amount = l10nMessages.TR_NOT_ENOUGH_FUNDS;
} else if (new BigNumber(state.amount).isLessThanOrEqualTo('0')) {
state.errors.amount = 'Amount is too low';
// TODO: this is never gonna happen! It will fail in second if condiftion (isNumber validation)
state.errors.amount = l10nMessages.TR_AMOUNT_IS_TOO_LOW;
}
} else if (!validators.hasDecimals(state.amount, 18)) {
state.errors.amount = 'Maximum 18 decimals allowed';
state.errors.amount = {
...l10nMessages.TR_MAXIMUM_DECIMALS_ALLOWED,
values: {
decimals: 18,
},
};
} else if (
new BigNumber(state.total).isGreaterThan(
new BigNumber(account.balance).minus(pendingAmount)
)
) {
state.errors.amount = 'Not enough funds';
state.errors.amount = l10nMessages.TR_NOT_ENOUGH_FUNDS;
}
}
return state;
@ -288,13 +311,13 @@ export const gasLimitValidation = ($state: State): PayloadAction<State> => (
const { gasLimit } = state;
if (gasLimit.length < 1) {
state.errors.gasLimit = 'Gas limit is not set';
state.errors.gasLimit = l10nMessages.TR_GAS_LIMIT_IS_NOT_SET;
} else if (gasLimit.length > 0 && !validators.isNumber(gasLimit)) {
state.errors.gasLimit = 'Gas limit is not a number';
state.errors.gasLimit = l10nMessages.TR_GAS_LIMIT_IS_NOT_A_NUMBER;
} else {
const gl: BigNumber = new BigNumber(gasLimit);
if (gl.isLessThan(1)) {
state.errors.gasLimit = 'Gas limit is too low';
state.errors.gasLimit = l10nMessages.TR_GAS_LIMIT_IS_TOO_LOW;
} else if (
gl.isLessThan(
state.currency !== state.networkSymbol
@ -302,7 +325,7 @@ export const gasLimitValidation = ($state: State): PayloadAction<State> => (
: network.defaultGasLimit
)
) {
state.warnings.gasLimit = 'Gas limit is below recommended';
state.warnings.gasLimit = l10nMessages.TR_GAS_LIMIT_IS_BELOW_RECOMMENDED;
}
}
return state;
@ -317,15 +340,15 @@ export const gasPriceValidation = ($state: State): PayloadAction<State> => (): S
const { gasPrice } = state;
if (gasPrice.length < 1) {
state.errors.gasPrice = 'Gas price is not set';
state.errors.gasPrice = l10nMessages.TR_GAS_PRICE_IS_NOT_SET;
} else if (gasPrice.length > 0 && !validators.isNumber(gasPrice)) {
state.errors.gasPrice = 'Gas price is not a number';
state.errors.gasPrice = l10nMessages.TR_GAS_PRICE_IS_NOT_A_NUMBER;
} else {
const gp: BigNumber = new BigNumber(gasPrice);
if (gp.isGreaterThan(1000)) {
state.warnings.gasPrice = 'Gas price is too high';
state.warnings.gasPrice = l10nMessages.TR_GAS_PRICE_IS_TOO_HIGH;
} else if (gp.isLessThanOrEqualTo('0')) {
state.errors.gasPrice = 'Gas price is too low';
state.errors.gasPrice = l10nMessages.TR_GAS_PRICE_IS_TOO_LOW;
}
}
return state;
@ -346,28 +369,29 @@ export const nonceValidation = ($state: State): PayloadAction<State> => (
const { nonce } = state;
if (nonce.length < 1) {
state.errors.nonce = 'Nonce is not set';
state.errors.nonce = l10nMessages.TR_NONCE_IS_NOT_SET;
} else if (!validators.isAbs(nonce)) {
state.errors.nonce = 'Nonce is not a valid number';
state.errors.nonce = l10nMessages.TR_NONCE_IS_NOT_A_NUMBER;
} else {
const n: BigNumber = new BigNumber(nonce);
if (n.isLessThan(account.nonce)) {
state.warnings.nonce = 'Nonce is lower than recommended';
state.warnings.nonce = l10nMessages.TR_NONCE_IS_LOWER_THAN_RECOMMENDED;
} else if (n.isGreaterThan(account.nonce)) {
state.warnings.nonce = 'Nonce is greater than recommended';
state.warnings.nonce = l10nMessages.TR_NONCE_IS_GREATER_THAN_RECOMMENDED;
}
}
return state;
};
/*
* Gas price value validation
* Data validation
*/
export const dataValidation = ($state: State): PayloadAction<State> => (): State => {
const state = { ...$state };
if (!state.touched.data || state.data.length === 0) return state;
if (!ethUtils.isHex(state.data)) {
state.errors.data = 'Data is not valid hexadecimal';
state.errors.data = l10nMessages.TR_DATA_IS_NOT_VALID_HEX;
}
return state;
};
@ -432,12 +456,13 @@ export const getFeeLevels = (
selected && selected.value === 'Custom'
? {
value: 'Custom',
localizedValue: l10nCommonMessages.TR_CUSTOM_FEE,
gasPrice: selected.gasPrice,
// label: `${ calculateFee(gasPrice, gasLimit) } ${ symbol }`
label: `${calculateFee(selected.gasPrice, gasLimit)} ${symbol}`,
}
: {
value: 'Custom',
localizedValue: l10nCommonMessages.TR_CUSTOM_FEE,
gasPrice: low,
label: '',
};
@ -445,16 +470,19 @@ export const getFeeLevels = (
return [
{
value: 'High',
localizedValue: l10nCommonMessages.TR_HIGH_FEE,
gasPrice: high,
label: `${calculateFee(high, gasLimit)} ${symbol}`,
},
{
value: 'Normal',
localizedValue: l10nCommonMessages.TR_NORMAL_FEE,
gasPrice: gasPrice.toString(),
label: `${calculateFee(price.toFixed(), gasLimit)} ${symbol}`,
},
{
value: 'Low',
localizedValue: l10nCommonMessages.TR_LOW_FEE,
gasPrice: low,
label: `${calculateFee(low, gasLimit)} ${symbol}`,
},

View File

@ -1,4 +1,6 @@
/* @flow */
import React from 'react';
import { FormattedMessage } from 'react-intl';
import TrezorConnect from 'trezor-connect';
import * as NOTIFICATION from 'actions/constants/notification';
import * as SEND from 'actions/constants/send';
@ -19,6 +21,7 @@ import type {
TrezorDevice,
} from 'flowtype';
import type { State, FeeLevel } from 'reducers/SendFormRippleReducer';
import l10nMessages from 'components/notifications/Context/actions.messages';
import * as SessionStorageActions from '../SessionStorageActions';
import * as BlockchainActions from './BlockchainActions';
@ -455,7 +458,7 @@ export const onSend = (): AsyncAction => async (
type: NOTIFICATION.ADD,
payload: {
variant: 'error',
title: 'Transaction error',
title: <FormattedMessage {...l10nMessages.TR_TRANSACTION_ERROR} />,
message: signedTransaction.payload.error,
cancelable: true,
actions: [],
@ -474,7 +477,7 @@ export const onSend = (): AsyncAction => async (
type: NOTIFICATION.ADD,
payload: {
variant: 'error',
title: 'Transaction error',
title: <FormattedMessage {...l10nMessages.TR_TRANSACTION_ERROR} />,
message: push.payload.error,
cancelable: true,
actions: [],
@ -497,7 +500,7 @@ export const onSend = (): AsyncAction => async (
type: NOTIFICATION.ADD,
payload: {
variant: 'success',
title: 'Transaction success',
title: <FormattedMessage {...l10nMessages.TR_TRANSACTION_SUCCESS} />,
message: txid,
cancelable: true,
actions: [],

View File

@ -6,6 +6,8 @@ import { findDevice, getPendingAmount } from 'reducers/utils';
import { toDecimalAmount } from 'utils/formatUtils';
import { toFiatCurrency } from 'utils/fiatConverter';
import * as validators from 'utils/validators';
import l10nMessages from 'views/Wallet/views/Account/Send/validation.messages';
import l10nCommonMessages from 'views/common.messages';
import type {
Dispatch,
@ -150,11 +152,11 @@ const addressValidation = ($state: State): PayloadAction<State> => (
const { address } = state;
if (address.length < 1) {
state.errors.address = 'Address is not set';
state.errors.address = l10nMessages.TR_ADDRESS_IS_NOT_SET;
} else if (!AddressValidator.validate(address, 'XRP')) {
state.errors.address = 'Address is not valid';
state.errors.address = l10nMessages.TR_ADDRESS_IS_NOT_VALID;
} else if (address.toLowerCase() === account.descriptor.toLowerCase()) {
state.errors.address = 'Cannot send to myself';
state.errors.address = l10nMessages.TR_CANNOT_SEND_TO_MYSELF;
}
return state;
};
@ -226,9 +228,13 @@ const addressLabel = ($state: State): PayloadAction<State> => (
currentNetworkAccount.deviceState
);
if (device) {
state.infos.address = `${
device.instanceLabel
} Account #${currentNetworkAccount.index + 1}`;
state.infos.address = {
...l10nCommonMessages.TR_DEVICE_LABEL_ACCOUNT_HASH,
values: {
deviceLabel: device.instanceLabel,
number: currentNetworkAccount.index + 1,
},
};
}
} else {
// corner-case: the same derivation path is used on different networks
@ -241,11 +247,14 @@ const addressLabel = ($state: State): PayloadAction<State> => (
const { networks } = getState().localStorage.config;
const otherNetwork = networks.find(c => c.shortcut === otherNetworkAccount.network);
if (device && otherNetwork) {
state.warnings.address = `Looks like it's ${
device.instanceLabel
} Account #${otherNetworkAccount.index + 1} address of ${
otherNetwork.name
} network`;
state.warnings.address = {
...l10nCommonMessages.TR_LOOKS_LIKE_IT_IS_DEVICE_LABEL,
values: {
deviceLabel: device.instanceLabel,
number: otherNetworkAccount.index + 1,
network: otherNetwork.name,
},
};
}
}
}
@ -268,19 +277,22 @@ const amountValidation = ($state: State): PayloadAction<State> => (
const { amount } = state;
if (amount.length < 1) {
state.errors.amount = 'Amount is not set';
state.errors.amount = l10nMessages.TR_AMOUNT_IS_NOT_SET;
} else if (amount.length > 0 && !validators.isNumber(amount)) {
state.errors.amount = 'Amount is not a number';
state.errors.amount = l10nMessages.TR_AMOUNT_IS_NOT_A_NUMBER;
} else {
const pendingAmount: BigNumber = getPendingAmount(pending, state.networkSymbol);
if (!validators.hasDecimals(state.amount, 6)) {
state.errors.amount = 'Maximum 6 decimals allowed';
state.errors.amount = {
...l10nMessages.TR_MAXIMUM_DECIMALS_ALLOWED,
values: { decimals: 6 },
};
} else if (
new BigNumber(state.total).isGreaterThan(
new BigNumber(account.balance).minus(pendingAmount)
)
) {
state.errors.amount = 'Not enough funds';
state.errors.amount = l10nMessages.TR_NOT_ENOUGH_FUNDS;
}
}
@ -288,15 +300,23 @@ const amountValidation = ($state: State): PayloadAction<State> => (
!state.errors.amount &&
new BigNumber(account.balance).minus(state.total).lt(account.reserve)
) {
state.errors.amount = `Not enough funds. Reserved amount for this account is ${
account.reserve
} ${state.networkSymbol}`;
state.errors.amount = {
...l10nMessages.TR_NOT_ENOUGH_FUNDS_RESERVED_AMOUNT,
values: {
reservedAmount: account.reserve,
networkSymbol: state.networkSymbol,
},
};
}
if (!state.errors.amount && new BigNumber(state.amount).lt(state.minAmount)) {
state.errors.amount = `Amount is too low. Minimum amount for creating a new account is ${
state.minAmount
} ${state.networkSymbol}`;
state.errors.amount = {
...l10nMessages.TR_AMOUNT_IS_TOO_LOW_MINIMUM_AMOUNT_FOR_CREATING,
values: {
reservedAmount: state.minAmount,
networkSymbol: state.networkSymbol,
},
};
}
return state;
@ -317,15 +337,15 @@ export const feeValidation = ($state: State): PayloadAction<State> => (
const { fee } = state;
if (fee.length < 1) {
state.errors.fee = 'Fee is not set';
state.errors.fee = l10nMessages.TR_FEE_IS_NOT_SET;
} else if (fee.length > 0 && !validators.isAbs(fee)) {
state.errors.fee = 'Fee must be an absolute number';
state.errors.fee = l10nMessages.TR_FEE_MUST_ME_AN_ABSOLUT_NUMBER;
} else {
const gl: BigNumber = new BigNumber(fee);
if (gl.isLessThan(network.fee.minFee)) {
state.errors.fee = 'Fee is below recommended';
state.errors.fee = l10nMessages.TR_FEE_IS_BELOW_RECOMMENDED;
} else if (gl.isGreaterThan(network.fee.maxFee)) {
state.errors.fee = 'Fee is above recommended';
state.errors.fee = l10nMessages.TR_FEE_IS_ABOVE_RECOMMENDED;
}
}
return state;
@ -340,11 +360,11 @@ export const destinationTagValidation = ($state: State): PayloadAction<State> =>
const { destinationTag } = state;
if (destinationTag.length > 0 && !validators.isAbs(destinationTag)) {
state.errors.destinationTag = 'Destination tag must be an absolute number';
state.errors.destinationTag = l10nMessages.TR_DESTINATION_TAG_MUST_BE_AN_ABSOLUTE;
}
if (parseInt(destinationTag, 10) > U_INT_32) {
state.errors.destinationTag = 'Number is too big';
state.errors.destinationTag = l10nMessages.TR_DESTINATION_TAG_IS_NOT_VALID;
}
return state;
@ -386,9 +406,16 @@ export const getFeeLevels = (
const { network } = getState().selectedAccount;
if (!network) return []; // flowtype fallback
const l10nFeeMap = {
Low: l10nCommonMessages.TR_LOW_FEE,
Normal: l10nCommonMessages.TR_NORMAL_FEE,
High: l10nCommonMessages.TR_HIGH_FEE,
};
// map BlockchainFeeLevel to SendFormReducer FeeLevel
const levels = feeLevels.map(level => ({
value: level.name,
localizedValue: l10nFeeMap[level.value],
fee: level.value,
label: `${toDecimalAmount(level.value, network.decimals)} ${network.symbol}`,
}));
@ -398,11 +425,13 @@ export const getFeeLevels = (
selected && selected.value === 'Custom'
? {
value: 'Custom',
localizedValue: l10nCommonMessages.TR_CUSTOM_FEE,
fee: selected.fee,
label: `${toDecimalAmount(selected.fee, network.decimals)} ${network.symbol}`,
}
: {
value: 'Custom',
localizedValue: l10nCommonMessages.TR_CUSTOM_FEE,
fee: '0',
label: '',
};

View File

@ -1,9 +1,9 @@
// TODO: l10n for device status
import React from 'react';
import styled, { css } from 'styled-components';
import PropTypes from 'prop-types';
import { getStatusColor, getStatusName, getStatus } from 'utils/device';
import { TrezorImage, colors } from 'trezor-ui-components';
import { injectIntl } from 'react-intl';
import { FONT_SIZE, FONT_WEIGHT } from 'config/variables';
@ -102,6 +102,7 @@ const DeviceHeader = ({
isSelected = false,
className,
testId,
intl,
}) => {
const status = getStatus(device);
return (
@ -123,7 +124,7 @@ const DeviceHeader = ({
</ImageWrapper>
<LabelWrapper>
<Name>{device.instanceLabel}</Name>
<Status title={getStatusName(status)}>{getStatusName(status)}</Status>
<Status title={getStatusName(status, intl)}>{getStatusName(status, intl)}</Status>
</LabelWrapper>
<IconWrapper>{icon && !disabled && isAccessible && icon}</IconWrapper>
</Wrapper>
@ -141,6 +142,7 @@ DeviceHeader.propTypes = {
onClickWrapper: PropTypes.func.isRequired,
className: PropTypes.string,
testId: PropTypes.string,
intl: PropTypes.any,
};
export default DeviceHeader;
export default injectIntl(DeviceHeader);

View File

@ -0,0 +1,63 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_CONNECTED: {
id: 'TR_CONNECTED',
defaultMessage: 'Connected',
description: 'Device status',
},
TR_CONNECTED_BOOTLOADER: {
id: 'TR_CONNECTED_BOOTLOADER',
defaultMessage: 'Connected (bootloader mode)',
description: 'Device status',
},
TR_CONNECTED_NOT_INITIALIZED: {
id: 'TR_CONNECTED_NOT_INITIALIZED',
defaultMessage: 'Connected (not initialized)',
description: 'Device status',
},
TR_CONNECTED_SEEDLESS: {
id: 'TR_CONNECTED_SEEDLESS',
defaultMessage: 'Connected (seedless mode)',
description: 'Device status',
},
TR_CONNECTED_UPDATE_REQUIRED: {
id: 'TR_CONNECTED_UPDATE_REQUIRED',
defaultMessage: 'Connected (update required)',
description: 'Device status',
},
TR_CONNECTED_UPDATE_RECOMMENDED: {
id: 'TR_CONNECTED_UPDATE_RECOMMENDED',
defaultMessage: 'Connected (update recommended)',
description: 'Device status',
},
TR_USED_IN_ANOTHER_WINDOW: {
id: 'TR_USED_IN_ANOTHER_WINDOW',
defaultMessage: 'Used in other window',
description: 'Device status',
},
TR_UNAVAILABLE: {
id: 'TR_UNAVAILABLE',
defaultMessage: 'Unavailable',
description: 'Device status',
},
TR_UNREADABLE: {
id: 'TR_UNREADABLE',
defaultMessage: 'Unreadable',
description: 'Device status',
},
TR_DISCONNECTED: {
id: 'TR_DISCONNECTED',
defaultMessage: 'Disconnected',
description: 'Device status',
},
TR_STATUS_UNKNOWN: {
id: 'TR_STATUS_UNKNOWN',
defaultMessage: 'Status unknown',
description: 'Device status',
},
});
export default definedMessages;

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_TERMS: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_MENU: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_ATTENTION_COLON_THE_LOG_CONTAINS: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_SCAN_QR_CODE: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_CONFIRM_ACTION_ON_YOUR: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_CONFIRM_ADDRESS_ON_TREZOR: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_CONFIRM_TRANSACTION_ON: {

View File

@ -145,7 +145,7 @@ class ConfirmUnverifiedAddress extends PureComponent<Props> {
<Content>
<Row>
<Button onClick={() => (!account ? this.verifyAddress() : 'false')}>
<FormattedMessage {...l10nMessages.TR_TRY_AGAIN} />
<FormattedMessage {...l10nCommonMessages.TR_TRY_AGAIN} />
</Button>
<Button
isInverse

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_DEVICE_LABEL_IS_NOT_CONNECTED: {
@ -33,11 +33,6 @@ const definedMessages: Messages = defineMessages({
id: 'TR_SHOW_UNVERIFIED_ADDRESS',
defaultMessage: 'Show unverified address',
},
TR_TRY_AGAIN: {
id: 'TR_TRY_AGAIN',
defaultMessage: 'Try again',
description: 'Try to verify the address again',
},
TR_TO_PREVENT_PHISHING_ATTACKS_COMMA: {
id: 'TR_TO_PREVENT_PHISHING_ATTACKS_COMMA',
defaultMessage:

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_DONT_FORGET: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_WOULD_YOU_LIKE_TREZOR_WALLET_TO: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_SELECT_WALLET_TYPE_FOR: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_FORGET_LABEL: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_CARDANO_WALLET: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_NEM_WALLET: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_STELLAR_WALLET: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_TEZOS_WALLET: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_YOU_WILL_BE_REDIRECTED_TO_EXTERNAL: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_ENTER_DEVICE_PASSPHRASE: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_ENTERED_PIN_NOT_CORRECT: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_THE_PIN_LAYOUT_IS_DISPLAYED_ON: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_YOU_WERE_DISCONNECTED_DOT: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_NEW_TREZOR_BRIDGE_IS_AVAILABLE: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_NEW_TREZOR_FIRMWARE_IS_AVAILABLE_DOT: {

View File

@ -0,0 +1,54 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_ACQUIRE_DEVICE_ERROR: {
id: 'TR_ACQUIRE_DEVICE_ERROR',
defaultMessage: 'Acquire device error',
},
TR_AUTHENTICATION_ERROR: {
id: 'TR_AUTHENTICATION_ERROR',
defaultMessage: 'Authentication error',
},
TR_ACCOUNT_DISCOVERY_ERROR: {
id: 'TR_ACCOUNT_DISCOVERY_ERROR',
defaultMessage: 'Account discovery error',
description: 'Error during account discovery',
},
TR_TRANSACTION_ERROR: {
id: 'TR_TRANSACTION_ERROR',
defaultMessage: 'Transaction error',
description: 'Error during signing transaction',
},
TR_TRANSACTION_SUCCESS: {
id: 'TR_TRANSACTION_SUCCESS',
defaultMessage: 'Transaction has been sent successfully',
},
TR_SEE_TRANSACTION_DETAILS: {
id: 'TR_SEE_TRANSACTION_DETAILS',
defaultMessage: 'See transaction details',
},
TR_VERIFYING_ADDRESS_ERROR: {
id: 'TR_VERIFYING_ADDRESS_ERROR',
defaultMessage: 'Verifying address error',
},
TR_SIGN_MESSAGE_ERROR: {
id: 'TR_SIGN_MESSAGE_ERROR',
defaultMessage: 'Sign error',
},
TR_VERIFY_MESSAGE_ERROR: {
id: 'TR_VERIFY_MESSAGE_ERROR',
defaultMessage: 'Verify error',
},
TR_VERIFY_MESSAGE_SUCCESS: {
id: 'TR_VERIFY_MESSAGE_SUCCESS',
defaultMessage: 'Message has been successfully verified',
},
TR_SIGNATURE_IS_VALID: {
id: 'TR_SIGNATURE_IS_VALID',
defaultMessage: 'Signature is valid',
},
});
export default definedMessages;

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_CONNECT_TO_BACKEND: {

View File

@ -114,7 +114,16 @@ Group.propTypes = {
PropTypes.shape({
key: PropTypes.object,
type: PropTypes.string,
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
title: PropTypes.oneOfType([
PropTypes.string,
PropTypes.node,
PropTypes.shape({
id: PropTypes.string,
defaultMessage: PropTypes.string,
description: PropTypes.string,
values: PropTypes.object,
}),
]),
message: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
})
),

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_MINIMUM_ACCOUNT_RESERVE_REQUIRED: {

View File

@ -163,6 +163,9 @@ export type { Token } from 'reducers/TokensReducer';
export type { Web3Instance } from 'reducers/Web3Reducer';
export type { BlockchainFeeLevel } from 'reducers/BlockchainReducer';
export type { MessageDescriptor } from 'support/ConnectedIntlProvider'; // this service has no action file, all is written inside one file
export type { Messages } from 'support/ConnectedIntlProvider'; // this service has no action file, all is written inside one file
export type Accounts = $ElementType<State, 'accounts'>;
export type LocalStorage = $ElementType<State, 'localStorage'>;
export type Config = $PropertyType<$ElementType<State, 'localStorage'>, 'config'>;

View File

@ -1,14 +0,0 @@
export type MessageDescriptor = {
// A unique, stable identifier for the message
id: string,
// The default message (probably in English)
defaultMessage: string,
// Context for the translator about how it's used in the UI
description?: string | object,
};
export type Messages = {
[key: string]: MessageDescriptor
};

View File

@ -8,7 +8,7 @@ import { DEVICE } from 'trezor-connect';
import type { Action } from 'flowtype';
export type CallbackAction = {
label: string,
label: React.Node,
callback: Function,
};

View File

@ -3,7 +3,8 @@
import * as SEND from 'actions/constants/send';
import * as ACCOUNT from 'actions/constants/account';
import type { Action } from 'flowtype';
import type { Action, MessageDescriptor } from 'flowtype';
import l10nCommonMessages from 'views/common.messages';
export type FeeLevel = {
label: string,
@ -36,9 +37,9 @@ export type State = {
nonce: string,
total: string,
errors: { [k: string]: string },
warnings: { [k: string]: string },
infos: { [k: string]: string },
errors: { [k: string]: MessageDescriptor },
warnings: { [k: string]: MessageDescriptor },
infos: { [k: string]: MessageDescriptor },
sending: boolean,
};
@ -62,6 +63,7 @@ export const initialState: State = {
label: 'Normal',
gasPrice: '0',
value: 'Normal',
localizedValue: l10nCommonMessages.TR_NORMAL_FEE,
},
recommendedGasPrice: '0',
gasPriceNeedsUpdate: false,

View File

@ -3,12 +3,13 @@
import * as SEND from 'actions/constants/send';
import * as ACCOUNT from 'actions/constants/account';
import type { Action } from 'flowtype';
import type { Action, MessageDescriptor } from 'flowtype';
export type FeeLevel = {
label: string,
fee: string,
value: string,
localizedValue?: MessageDescriptor,
};
export type State = {
@ -33,9 +34,9 @@ export type State = {
destinationTag: string,
total: string,
errors: { [k: string]: string },
warnings: { [k: string]: string },
infos: { [k: string]: string },
errors: { [k: string]: MessageDescriptor },
warnings: { [k: string]: MessageDescriptor },
infos: { [k: string]: MessageDescriptor },
sending: boolean,
};

View File

@ -56,6 +56,20 @@ type Props = {|
...StateProps,
|};
export type MessageDescriptor = {
// A unique, stable identifier for the message
id: string,
// The default message (probably in English)
defaultMessage: string,
// Context for the translator about how it's used in the UI
description?: string,
values?: { [key: string]: any },
};
export type Messages = {
[key: string]: MessageDescriptor,
};
const mapStateToProps = (state: State): StateProps => ({
locale: state.wallet.language,
messages: state.wallet.messages,

View File

@ -76,15 +76,4 @@ describe('device utils', () => {
expect(utils.getStatusColor('disconnected')).toBe(colors.ERROR_PRIMARY);
expect(utils.getStatusColor('unavailable')).toBe(colors.ERROR_PRIMARY);
});
it('get status name', () => {
expect(utils.getStatusName(0)).toBe('Status unknown');
expect(utils.getStatusName(null)).toBe('Status unknown');
expect(utils.getStatusName('sdsdsdsd')).toBe('Status unknown');
expect(utils.getStatusName('used-in-other-window')).toBe('Used in other window');
expect(utils.getStatusName('connected')).toBe('Connected');
expect(utils.getStatusName('unacquired')).toBe('Used in other window');
expect(utils.getStatusName('disconnected')).toBe('Disconnected');
expect(utils.getStatusName('unavailable')).toBe('Unavailable');
});
});

View File

@ -1,10 +1,12 @@
/* @flow */
import { colors } from 'trezor-ui-components';
import type { IntlShape } from 'react-intl';
import type { Device } from 'trezor-connect';
import type { TrezorDevice, State } from 'flowtype';
import l10nMessages from 'components/DeviceHeader/index.messages';
type Transport = $ElementType<$ElementType<State, 'connect'>, 'transport'>;
export const getStatus = (device: TrezorDevice): string => {
@ -48,32 +50,32 @@ export const getStatus = (device: TrezorDevice): string => {
return 'unknown';
};
export const getStatusName = (deviceStatus: string): string => {
export const getStatusName = (deviceStatus: string, intl: IntlShape): string => {
switch (deviceStatus) {
case 'connected':
return 'Connected';
return intl.formatMessage(l10nMessages.TR_CONNECTED);
case 'disconnected':
return 'Disconnected';
return intl.formatMessage(l10nMessages.TR_DISCONNECTED);
case 'bootloader':
return 'Connected (bootloader mode)';
return intl.formatMessage(l10nMessages.TR_CONNECTED_BOOTLOADER);
case 'initialize':
return 'Connected (not initialized)';
return intl.formatMessage(l10nMessages.TR_CONNECTED_NOT_INITIALIZED);
case 'seedless':
return 'Connected (seedless mode)';
return intl.formatMessage(l10nMessages.TR_CONNECTED_SEEDLESS);
case 'firmware-required':
return 'Connected (update required)';
return intl.formatMessage(l10nMessages.TR_CONNECTED_UPDATE_REQUIRED);
case 'firmware-recommended':
return 'Connected (update recommended)';
return intl.formatMessage(l10nMessages.TR_CONNECTED_UPDATE_RECOMMENDED);
case 'used-in-other-window':
return 'Used in other window';
return intl.formatMessage(l10nMessages.TR_USED_IN_ANOTHER_WINDOW);
case 'unacquired':
return 'Used in other window';
return intl.formatMessage(l10nMessages.TR_USED_IN_ANOTHER_WINDOW);
case 'unavailable':
return 'Unavailable';
return intl.formatMessage(l10nMessages.TR_UNAVAILABLE);
case 'unreadable':
return 'Unreadable';
return intl.formatMessage(l10nMessages.TR_UNREADABLE);
default:
return 'Status unknown';
return intl.formatMessage(l10nMessages.TR_STATUS_UNKNOWN);
}
};

16
src/utils/uiUtils.js Normal file
View File

@ -0,0 +1,16 @@
/* @flow */
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
export const getBottomText = (error: any, warning: any, info: any): React.Node => {
if (error) {
return <FormattedMessage {...error} />;
}
if (warning) {
return <FormattedMessage {...warning} />;
}
if (info) {
return <FormattedMessage {...info} />;
}
return null;
};

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_YOU_ARE_OPENING_TREZOR_BETA_WALLET: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_YOUR_BROWSER_IS_NOT_SUPPORTED: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_TREZOR_WALLET_IS_AN_EASY_DASH: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_NEW_COMMUNICATION_TOOL: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_FIND_OUT_MORE_INFO: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_INITIALIZING_ACCOUNTS: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_TO_ADD_A_NEW_ACCOUNT_LAST: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_OTHER_COINS: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_CHANGE_WALLET_TYPE: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({});

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_YOU_ARE_IN_YOUR_STANDARD_WALLET: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_NAV_SUMMARY: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_CHECK_ADDRESS_ON_TREZOR: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_UNVERIFIED_ADDRESS_COMMA_CONNECT: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_RECEIVE_ETHEREUM_OR_TOKENS: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_RECEIVE_RIPPLE: {

View File

@ -15,7 +15,7 @@ import {
import type { IntlShape } from 'react-intl';
import { FONT_SIZE } from 'config/variables';
import { getBottomText } from 'utils/uiUtils';
import l10nCommonMessages from 'views/common.messages';
import l10nMessages from './index.messages';
@ -81,7 +81,7 @@ const AdvancedSettingsSendButtonWrapper = styled.div`
justify-content: flex-end;
`;
const getGasLimitInputState = (gasLimitErrors: string, gasLimitWarnings: string): ?string => {
const getGasLimitInputState = (gasLimitErrors: boolean, gasLimitWarnings: boolean): ?string => {
let state = null;
if (gasLimitWarnings && !gasLimitErrors) {
state = 'warning';
@ -92,7 +92,7 @@ const getGasLimitInputState = (gasLimitErrors: string, gasLimitWarnings: string)
return state;
};
const getGasPriceInputState = (gasPriceErrors: string, gasPriceWarnings: string): ?string => {
const getGasPriceInputState = (gasPriceErrors: boolean, gasPriceWarnings: boolean): ?string => {
let state = null;
if (gasPriceWarnings && !gasPriceErrors) {
state = 'warning';
@ -103,7 +103,7 @@ const getGasPriceInputState = (gasPriceErrors: string, gasPriceWarnings: string)
return state;
};
const getDataTextareaState = (dataError: string, dataWarning: string): ?string => {
const getDataTextareaState = (dataError: boolean, dataWarning: boolean): ?string => {
let state = null;
if (dataWarning) {
state = 'warning';
@ -177,7 +177,7 @@ const AdvancedForm = (props: Props) => {
<AdvancedSettingsWrapper>
<GasInputRow>
<GasInput
state={getGasLimitInputState(errors.gasLimit, warnings.gasLimit)}
state={getGasLimitInputState(!!errors.gasLimit, !!warnings.gasLimit)}
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
@ -234,7 +234,7 @@ const AdvancedForm = (props: Props) => {
)}
</InputLabelWrapper>
}
bottomText={errors.gasLimit || warnings.gasLimit || infos.gasLimit}
bottomText={getBottomText(errors.gasLimit, warnings.gasLimit, infos.gasLimit)}
value={
calculatingGasLimit
? props.intl.formatMessage(l10nMessages.TR_CALCULATING_DOT_DOT)
@ -245,7 +245,7 @@ const AdvancedForm = (props: Props) => {
/>
<GasInput
state={getGasPriceInputState(errors.gasPrice, warnings.gasPrice)}
state={getGasPriceInputState(!!errors.gasPrice, !!warnings.gasPrice)}
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
@ -292,7 +292,7 @@ const AdvancedForm = (props: Props) => {
</Left>
</InputLabelWrapper>
}
bottomText={errors.gasPrice || warnings.gasPrice || infos.gasPrice}
bottomText={getBottomText(errors.gasPrice, warnings.gasPrice, infos.gasPrice)}
value={gasPrice}
onChange={event => onGasPriceChange(event.target.value)}
/>
@ -322,8 +322,8 @@ const AdvancedForm = (props: Props) => {
</Left>
</InputLabelWrapper>
}
state={getDataTextareaState(errors.data, warnings.data)}
bottomText={errors.data || warnings.data || infos.data}
state={getDataTextareaState(!!errors.data, !!warnings.data)}
bottomText={getBottomText(errors.data, warnings.data, infos.data)}
isDisabled={networkSymbol !== currency}
value={networkSymbol !== currency ? '' : data}
onChange={event => onDataChange(event.target.value)}

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_GAS_LIMIT: {

View File

@ -12,6 +12,7 @@ import * as stateUtils from 'reducers/utils';
import type { Token } from 'flowtype';
import { FormattedMessage } from 'react-intl';
import l10nCommonMessages from 'views/common.messages';
import { getBottomText } from 'utils/uiUtils';
import AdvancedForm from './components/AdvancedForm';
import PendingTransactions from '../components/PendingTransactions';
@ -204,8 +205,8 @@ const StyledIcon = styled(Icon)`
// render helpers
const getAddressInputState = (
address: string,
addressErrors: string,
addressWarnings: string
addressErrors: boolean,
addressWarnings: boolean
): ?string => {
let state = null;
if (address && !addressErrors) {
@ -220,7 +221,7 @@ const getAddressInputState = (
return state;
};
const getAmountInputState = (amountErrors: string, amountWarnings: string): ?string => {
const getAmountInputState = (amountErrors: boolean, amountWarnings: boolean): ?string => {
let state = null;
if (amountWarnings && !amountErrors) {
state = 'warning';
@ -347,13 +348,13 @@ const AccountSend = (props: Props) => {
</Title>
<InputRow>
<Input
state={getAddressInputState(address, errors.address, warnings.address)}
state={getAddressInputState(address, !!errors.address, !!warnings.address)}
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
spellCheck="false"
topLabel={props.intl.formatMessage(l10nCommonMessages.TR_ADDRESS)}
bottomText={errors.address || warnings.address || infos.address}
bottomText={getBottomText(errors.address, warnings.address, infos.address)}
value={address}
onChange={event => onAddressChange(event.target.value)}
sideAddons={[
@ -365,7 +366,7 @@ const AccountSend = (props: Props) => {
</InputRow>
<AmountRow>
<Input
state={getAmountInputState(errors.amount, warnings.amount)}
state={getAmountInputState(!!errors.amount, !!warnings.amount)}
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
@ -391,7 +392,7 @@ const AccountSend = (props: Props) => {
}
value={amount}
onChange={event => onAmountChange(event.target.value)}
bottomText={errors.amount || warnings.amount || infos.amount}
bottomText={getBottomText(errors.amount, warnings.amount, infos.amount)}
sideAddons={[
<SetMaxAmountButton key="icon" onClick={() => onSetMax()} isWhite={!setMax}>
{!setMax && (
@ -420,7 +421,7 @@ const AccountSend = (props: Props) => {
<LocalAmountWrapper>
<EqualsSign>=</EqualsSign>
<LocalAmountInput
state={getAmountInputState(errors.amount, warnings.amount)}
state={getAmountInputState(!!errors.amount, !!warnings.amount)}
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
@ -468,7 +469,9 @@ const AccountSend = (props: Props) => {
options={feeLevels}
formatOptionLabel={option => (
<FeeOptionWrapper>
<OptionValue>{option.value}</OptionValue>
<OptionValue>
<FormattedMessage {...option.localizedValue} />
</OptionValue>
<OptionLabel>{option.label}</OptionLabel>
</FeeOptionWrapper>
)}

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_SEND_ETHEREUM_OR_TOKENS: {

View File

@ -4,7 +4,7 @@ import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import styled from 'styled-components';
import { Input, Tooltip, Icon, colors, icons as ICONS } from 'trezor-ui-components';
import { getBottomText } from 'utils/uiUtils';
import l10nCommonMessages from 'views/common.messages';
import l10nSendMessages from 'views/Wallet/views/Account/common.messages';
import l10nMessages from './index.messages';
@ -52,7 +52,7 @@ const TooltipContainer = styled.div`
margin-left: 6px;
`;
const getFeeInputState = (feeErrors: string, feeWarnings: string): ?string => {
const getFeeInputState = (feeErrors: boolean, feeWarnings: boolean): ?string => {
let state = null;
if (feeWarnings && !feeErrors) {
state = 'warning';
@ -63,7 +63,7 @@ const getFeeInputState = (feeErrors: string, feeWarnings: string): ?string => {
return state;
};
const getDestinationTagInputState = (errors: string, warnings: string): ?string => {
const getDestinationTagInputState = (errors: boolean, warnings: boolean): ?string => {
let state = null;
if (warnings && !errors) {
state = 'warning';
@ -90,7 +90,7 @@ const AdvancedForm = (props: Props) => {
<AdvancedSettingsWrapper>
<InputRow>
<StyledInput
state={getFeeInputState(errors.fee, warnings.fee)}
state={getFeeInputState(!!errors.fee, !!warnings.fee)}
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
@ -125,7 +125,7 @@ const AdvancedForm = (props: Props) => {
</Left>
</InputLabelWrapper>
}
bottomText={errors.fee || warnings.fee || infos.fee}
bottomText={getBottomText(errors.fee, warnings.fee, infos.fee)}
value={fee}
onChange={event => onFeeChange(event.target.value)}
/>
@ -134,8 +134,8 @@ const AdvancedForm = (props: Props) => {
<InputRow>
<StyledInput
state={getDestinationTagInputState(
errors.destinationTag,
warnings.destinationTag
!!errors.destinationTag,
!!warnings.destinationTag
)}
autoComplete="off"
autoCorrect="off"
@ -171,9 +171,11 @@ const AdvancedForm = (props: Props) => {
</Left>
</InputLabelWrapper>
}
bottomText={
errors.destinationTag || warnings.destinationTag || infos.destinationTag
}
bottomText={getBottomText(
errors.destinationTag,
warnings.destinationTag,
infos.destinationTag
)}
value={destinationTag}
onChange={event => onDestinationTagChange(event.target.value)}
/>

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_XRP_TRANSFER_COST: {

View File

@ -10,9 +10,9 @@ import { FIAT_CURRENCIES } from 'config/app';
import Title from 'views/Wallet/components/Title';
import l10nCommonMessages from 'views/common.messages';
import Content from 'views/Wallet/components/Content';
import { getBottomText } from 'utils/uiUtils';
import PendingTransactions from '../components/PendingTransactions';
import AdvancedForm from './components/AdvancedForm';
import l10nMessages from './index.messages';
import l10nSendMessages from '../../common.messages';
@ -202,8 +202,8 @@ const StyledIcon = styled(Icon)`
// render helpers
const getAddressInputState = (
address: string,
addressErrors: string,
addressWarnings: string
addressErrors: boolean,
addressWarnings: boolean
): ?string => {
let state = null;
if (address && !addressErrors) {
@ -218,7 +218,7 @@ const getAddressInputState = (
return state;
};
const getAmountInputState = (amountErrors: string, amountWarnings: string): ?string => {
const getAmountInputState = (amountErrors: boolean, amountWarnings: boolean): ?string => {
let state = null;
if (amountWarnings && !amountErrors) {
state = 'warning';
@ -317,13 +317,13 @@ const AccountSend = (props: Props) => {
</Title>
<InputRow>
<Input
state={getAddressInputState(address, errors.address, warnings.address)}
state={getAddressInputState(address, !!errors.address, !!warnings.address)}
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
spellCheck="false"
topLabel={props.intl.formatMessage(l10nCommonMessages.TR_ADDRESS)}
bottomText={errors.address || warnings.address || infos.address}
bottomText={getBottomText(errors.address, warnings.address, infos.address)}
value={address}
onChange={event => onAddressChange(event.target.value)}
sideAddons={[
@ -335,7 +335,7 @@ const AccountSend = (props: Props) => {
</InputRow>
<AmountRow>
<Input
state={getAmountInputState(errors.amount, warnings.amount)}
state={getAmountInputState(!!errors.amount, !!warnings.amount)}
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
@ -357,7 +357,7 @@ const AccountSend = (props: Props) => {
}
value={amount}
onChange={event => onAmountChange(event.target.value)}
bottomText={errors.amount || warnings.amount || infos.amount}
bottomText={getBottomText(errors.amount, warnings.amount, infos.amount)}
sideAddons={[
<SetMaxAmountButton key="icon" onClick={() => onSetMax()} isWhite={!setMax}>
{!setMax && (
@ -385,7 +385,7 @@ const AccountSend = (props: Props) => {
<LocalAmountWrapper>
<EqualsSign>=</EqualsSign>
<LocalAmountInput
state={getAmountInputState(errors.amount, warnings.amount)}
state={getAmountInputState(!!errors.amount, !!warnings.amount)}
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
@ -433,7 +433,13 @@ const AccountSend = (props: Props) => {
options={feeLevels}
formatOptionLabel={option => (
<FeeOptionWrapper>
<OptionValue>{option.value}</OptionValue>
<OptionValue>
{option.localizedValue ? (
<FormattedMessage {...option.localizedValue} />
) : (
option.value
)}
</OptionValue>
<OptionLabel>{option.label}</OptionLabel>
</FeeOptionWrapper>
)}

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_XRP_RESERVE: {

View File

@ -0,0 +1,134 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_AMOUNT_IS_NOT_SET: {
id: 'TR_AMOUNT_IS_NOT_SET',
defaultMessage: 'Amount is not set',
},
TR_AMOUNT_IS_NOT_A_NUMBER: {
id: 'TR_AMOUNT_IS_NOT_A_NUMBER',
defaultMessage: 'Amount is not a number',
},
TR_MAXIMUM_DECIMALS_ALLOWED: {
id: 'TR_MAXIMUM_DECIMALS_ALLOWED:',
defaultMessage: 'Maximum {decimals} decimals allowed',
},
TR_NOT_ENOUGH_FUNDS_TO_COVER_TRANSACTION: {
id: 'TR_NOT_ENOUGH_FUNDS_TO_COVER_TRANSACTION',
defaultMessage: 'Not enough {networkSymbol} to cover transaction fee',
},
TR_NOT_ENOUGH_FUNDS: {
id: 'TR_NOT_ENOUGH_FUNDS',
defaultMessage: 'Not enough funds',
},
TR_AMOUNT_IS_TOO_LOW: {
id: 'TR_AMOUNT_IS_TOO_LOW',
defaultMessage: 'Amount is too low',
},
TR_ADDRESS_IS_NOT_SET: {
id: 'TR_ADDRESS_IS_NOT_SET',
defaultMessage: 'Address is not set',
},
TR_ADDRESS_IS_NOT_VALID: {
id: 'TR_ADDRESS_IS_NOT_VALID',
defaultMessage: 'Address is not valid',
},
TR_ADDRESS_CHECKSUM_IS_NOT_VALID: {
id: 'TR_ADDRESS_CHECKSUM_IS_NOT_VALID',
defaultMessage: 'Address checksum is not valid',
},
TR_GAS_LIMIT_IS_NOT_SET: {
id: 'TR_GAS_LIMIT_IS_NOT_SET',
defaultMessage: 'Gas limit is not set',
},
TR_GAS_LIMIT_IS_NOT_A_NUMBER: {
id: 'TR_GAS_LIMIT_IS_NOT_A_NUMBER',
defaultMessage: 'Gas limit is not a number',
},
TR_GAS_LIMIT_IS_TOO_LOW: {
id: 'TR_GAS_LIMIT_IS_TOO_LOW',
defaultMessage: 'Gas limit is too low',
},
TR_GAS_LIMIT_IS_BELOW_RECOMMENDED: {
id: 'TR_GAS_LIMIT_IS_BELOW_RECOMMENDED',
defaultMessage: 'Gas limit is below recommended',
},
TR_GAS_PRICE_IS_NOT_A_NUMBER: {
id: 'TR_GAS_PRICE_IS_NOT_A_NUMBER',
defaultMessage: 'Gas price is not a number',
},
TR_GAS_PRICE_IS_NOT_SET: {
id: 'TR_GAS_PRICE_IS_NOT_SET',
defaultMessage: 'Gas price is not set',
},
TR_GAS_PRICE_IS_TOO_LOW: {
id: 'TR_GAS_PRICE_IS_TOO_LOW',
defaultMessage: 'Gas price is too low',
},
TR_GAS_PRICE_IS_TOO_HIGH: {
id: 'TR_GAS_PRICE_IS_TOO_HIGH',
defaultMessage: 'Gas price is too high',
},
TR_NONCE_IS_NOT_A_NUMBER: {
id: 'TR_NONCE_IS_NOT_A_NUMBER',
defaultMessage: 'Nonce is not a valid number',
},
TR_NONCE_IS_NOT_SET: {
id: 'TR_NONCE_IS_NOT_SET',
defaultMessage: 'Nonce is not set',
},
TR_NONCE_IS_GREATER_THAN_RECOMMENDED: {
id: 'TR_NONCE_IS_GREATER_THAN_RECOMMENDED',
defaultMessage: 'Nonce is greater than recommended',
},
TR_NONCE_IS_LOWER_THAN_RECOMMENDED: {
id: 'TR_NONCE_IS_LOWER_THAN_RECOMMENDED',
defaultMessage: 'Nonce is lower than recommended',
},
TR_DATA_IS_NOT_VALID_HEX: {
id: 'TR_DATA_IS_NOT_VALID_HEX',
defaultMessage: 'Data is not valid hexadecimal',
},
TR_CANNOT_SEND_TO_MYSELF: {
id: 'TR_CANNOT_SEND_TO_MYSELF',
defaultMessage: 'Cannot send to myself',
},
TR_NOT_ENOUGH_FUNDS_RESERVED_AMOUNT: {
id: 'TR_NOT_ENOUGH_FUNDS_RESERVED_AMOUNT',
defaultMessage:
'Not enough funds. Reserved amount for this account is {reservedAmount} {networkSymbol}',
},
TR_AMOUNT_IS_TOO_LOW_MINIMUM_AMOUNT_FOR_CREATING: {
id: 'TR_AMOUNT_IS_TOO_LOW_MINIMUM_AMOUNT_FOR_CREATING',
defaultMessage:
'Amount is too low. Minimum amount for creating a new account is {minimalAmount} {networkSymbol}',
},
TR_FEE_IS_NOT_SET: {
id: 'TR_FEE_IS_NOT_SET',
defaultMessage: 'Fee is not set',
},
TR_FEE_MUST_ME_AN_ABSOLUT_NUMBER: {
id: 'TR_FEE_MUST_ME_AN_ABSOLUT_NUMBER',
defaultMessage: 'Fee must be an absolute number',
},
TR_FEE_IS_BELOW_RECOMMENDED: {
id: 'TR_FEE_IS_BELOW_RECOMMENDED',
defaultMessage: 'Fee is below recommended',
},
TR_FEE_IS_ABOVE_RECOMMENDED: {
id: 'TR_FEE_IS_ABOVE_RECOMMENDED',
defaultMessage: 'Fee is above recommended',
},
TR_DESTINATION_TAG_MUST_BE_AN_ABSOLUTE: {
id: 'TR_DESTINATION_TAG_MUST_BE_AN_ABSOLUTE',
defaultMessage: 'Destination tag must be an absolute number',
},
TR_DESTINATION_TAG_IS_NOT_VALID: {
id: 'TR_DESTINATION_TAG_IS_NOT_VALID',
defaultMessage: 'Destination tag is not valid',
},
});
export default definedMessages;

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_MESSAGE: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_SEE_FULL_TRANSACTION_HISTORY: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_ADD_YOUR_TOKENS: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_BALANCE: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_AMOUNT: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_DEVICE_USED_IN_OTHER: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_YOUR_DEVICE_IS_IN_FIRMWARE: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_PLEASE_SELECT_YOUR: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_ITS_TIME_TO_UPDATE_FIRMWARE: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_YOUR_DEVICE_IS_NOT_INITIALIZED: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_PLEASE_USE_TO_CREATE_BACKUP: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_DEVICE_IS_INITIALIZED_IN_SEEDLESS_MODE: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_UNREADABLE_DEVICE: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_LOCAL_CURRENCY: {
@ -21,7 +21,7 @@ const definedMessages: Messages = defineMessages({
defaultMessage: 'Visible coins',
},
TR_VISIBLE_COINS_EXTERNAL: {
id: 'TR_VISIBLE_COINS',
id: 'TR_VISIBLE_COINS_EXTERNAL:',
defaultMessage: 'Visible external coins',
},
TR_VISIBLE_COINS_EXPLAINED: {

View File

@ -1,6 +1,6 @@
/* @flow */
import { defineMessages } from 'react-intl';
import type { Messages } from 'flowtype/npm/react-intl';
import type { Messages } from 'flowtype';
const definedMessages: Messages = defineMessages({
TR_DEVICE_SETTINGS: {
@ -16,6 +16,17 @@ const definedMessages: Messages = defineMessages({
defaultMessage: 'Account #{number}',
description: 'Used in auto-generated account label',
},
TR_DEVICE_LABEL_ACCOUNT_HASH: {
id: 'TR_DEVICE_LABEL_ACCOUNT_HASH',
defaultMessage: '{deviceLabel} Account #{number}',
description: 'Used in auto-generated account label',
},
TR_LOOKS_LIKE_IT_IS_DEVICE_LABEL: {
id: 'TR_LOOKS_LIKE_IT_IS_DEVICE_LABEL',
defaultMessage:
'Looks like it is {deviceLabel} Account #{number} address of {network} network',
description: 'Example: Looks like it is My Trezor Account #1 address of ETH network',
},
TR_IMPORTED_ACCOUNT_HASH: {
id: 'TR_IMPORTED_ACCOUNT_HASH',
defaultMessage: 'Imported account #{number}',
@ -100,6 +111,31 @@ const definedMessages: Messages = defineMessages({
id: 'TR_SHOW_ADDRESS_I_WILL_TAKE_THE_RISK',
defaultMessage: 'Show address, I will take the risk',
},
TR_HIGH_FEE: {
id: 'TR_HIGH_FEE',
defaultMessage: 'High',
description: 'fee level',
},
TR_NORMAL_FEE: {
id: 'TR_NORMAL_FEE',
defaultMessage: 'Normal',
description: 'fee level',
},
TR_LOW_FEE: {
id: 'TR_LOW_FEE',
defaultMessage: 'Low',
description: 'fee level',
},
TR_CUSTOM_FEE: {
id: 'TR_CUSTOM_FEE',
defaultMessage: 'Custom',
description: 'fee level',
},
TR_TRY_AGAIN: {
id: 'TR_TRY_AGAIN',
defaultMessage: 'Try again',
description: 'Try to run the proccess again',
},
});
export default definedMessages;