@edgex-web/components
Version:
EdgeX Universal UI Components Library - Reusable React components for deposit, withdraw and other common UI patterns
161 lines • 5.29 kB
TypeScript
/**
* 多语言翻译 Hook
*
* @example
* ```tsx
* const { t, locale } = useTranslation()
*
* // 基础用法
* const title = t('deposit.title') // "充值" 或 "Deposit"
*
* // 参数化翻译(字符串参数)
* const enableText = t('deposit.enableSystemProWithToken', {
* token: 'USDT',
* network: 'Ethereum'
* }) // "Enable USDT on Ethereum" 或 "在Ethereum上启用USDT"
*
* // 参数化翻译(数字参数)
* const arrivalText = t('deposit.arrivaltimeTooltip1', {
* v: 10, // 数字会自动转换为字符串
* v1: 12
* }) // "您可以在约 10 分钟 (达到 12 个区块确认后) 提走已到账的资金"
* ```
*/
export declare const useTranslation: () => {
t: (key: string, params?: Record<string, string | number>) => string;
translations: {
deposit: {
title: string;
chain: string;
asset: string;
amount: string;
available: string;
equity: string;
confirmDeposit: string;
switchNetwork: string;
max: string;
arrivalTime: string;
minDeposit: string;
minDepositParsed: string;
maxDeposit: string;
depositTipFor25w: string;
depositAllTip: string;
enableSystemProWithToken: string;
enableTokenDesc: string;
enableWithToken: string;
arrivaltimeTooltip1: string;
arrivaltimeTooltip2: string;
arrivalEstimated: string;
availableDesc: string;
noPrivateKeyWalletWarning: string;
layerZeroDepositTip: string;
layerZeroDepositTipExceedPool: string;
layerZeroDepositTipGte200k: string;
layerZeroDepositButton: string;
};
withdraw: {
noticeDesc: string;
crossChainTips: string;
commonWithdraw: string;
withdraw: string;
speed: string;
confirmWithdraw: string;
speedNote: string;
speedNoteSpeed1: string;
speedNoteSpeed2: string;
speedNoteSpeed3: string;
receiverAddress: string;
fee: string;
feeRate: string;
withdrawlAmount: string;
amountToReceive: string;
minWithdraw: string;
minWithdrawParsed: string;
invalidReceiverAddress: string;
availableDesc: string;
feeCalculationTip: string;
crossChainPoolBalance: string;
poolBalance: string;
poolBalanceInsufficientTip: string;
};
account: {
title: string;
perpetual: string;
spot: string;
};
};
locale: "en-US" | "ja-JP" | "ru-RU" | "zh-CN" | "zh-TW";
getTranslationObject: (key: string) => Record<string, any>;
hasTranslation: (key: string) => boolean;
};
/**
* 用于局部覆盖语言的 Hook
* @param localLocale - 局部语言设置
*/
export declare const useTranslationWithLocale: (localLocale?: string) => {
t: (key: string, params?: Record<string, string | number>) => string;
translations: {
deposit: {
title: string;
chain: string;
asset: string;
amount: string;
available: string;
equity: string;
confirmDeposit: string;
switchNetwork: string;
max: string;
arrivalTime: string;
minDeposit: string;
minDepositParsed: string;
maxDeposit: string;
depositTipFor25w: string;
depositAllTip: string;
enableSystemProWithToken: string;
enableTokenDesc: string;
enableWithToken: string;
arrivaltimeTooltip1: string;
arrivaltimeTooltip2: string;
arrivalEstimated: string;
availableDesc: string;
noPrivateKeyWalletWarning: string;
layerZeroDepositTip: string;
layerZeroDepositTipExceedPool: string;
layerZeroDepositTipGte200k: string;
layerZeroDepositButton: string;
};
withdraw: {
noticeDesc: string;
crossChainTips: string;
commonWithdraw: string;
withdraw: string;
speed: string;
confirmWithdraw: string;
speedNote: string;
speedNoteSpeed1: string;
speedNoteSpeed2: string;
speedNoteSpeed3: string;
receiverAddress: string;
fee: string;
feeRate: string;
withdrawlAmount: string;
amountToReceive: string;
minWithdraw: string;
minWithdrawParsed: string;
invalidReceiverAddress: string;
availableDesc: string;
feeCalculationTip: string;
crossChainPoolBalance: string;
poolBalance: string;
poolBalanceInsufficientTip: string;
};
account: {
title: string;
perpetual: string;
spot: string;
};
};
locale: string;
};
export default useTranslation;
//# sourceMappingURL=useTranslation.d.ts.map