import { deepMerge } from '@/utils/deepMerge'
import { koUiOverlay } from './futuresPage/overlays/ko'
import { jaUiOverlay } from './futuresPage/overlays/ja'
import { hiUiOverlay } from './futuresPage/overlays/hi'
import { idUiOverlay } from './futuresPage/overlays/id'
import { esUiOverlay } from './futuresPage/overlays/es'
import { ruUiOverlay } from './futuresPage/overlays/ru'
import { ptUiOverlay } from './futuresPage/overlays/pt'
import { deUiOverlay } from './futuresPage/overlays/de'
import { frUiOverlay } from './futuresPage/overlays/fr'
import { trUiOverlay } from './futuresPage/overlays/tr'
import { viUiOverlay } from './futuresPage/overlays/vi'

/** 深度可选（用于各语言 overlay 局部覆盖） */
export type DeepPartial<T> = {
	[P in keyof T]?: T[P] extends Record<string, unknown> ? DeepPartial<T[P]> : T[P]
}

/** 合约页（FuturesView）文案：供各语言入口复用，禁止在组件内硬编码用户可见中文。 */
export type FuturesPageMessages = {
	perpetual : string
	/** 资金流水币种后缀，如 USDT + 永续 */
	perpetualTag : string
	pairSearchPlaceholder : string
	pairSearchTag:{
		oneType: string,
		twoType: string,
		threeType: string,
		fourType: string,
	},
	pairEmpty : string
	stats : {
		change24h : string
		markPrice : string
		high24h : string
		low24h : string
		volume24h : string
		fundingCountdown : string
	}
	mobileTabs : { chart : string; trade : string }
	chartSub : { chart : string; coinInfo : string; fundingHistory : string }
	tf : { m1 : string; m5 : string; m15 : string; m30 : string; h1 : string; h4 : string; d1 : string, w1 : string, mo1 : string, mo3 : string }
	chartTools : { fullscreen : string; alert : string }
	draw : {
		cursor : string
		trend : string
		hline : string
		ray : string
		channel : string
		fib : string
		text : string
		clearAll : string
		zoomOut : string
	}
	ohlcv : { open : string; high : string; low : string; close : string; volume : string; changePct : string; amplitude : string }
	coinInfo : {
		marketCap : string
		circulating : string
		issuePrice : string
		ath : string
		athDate : string
		whitepaper : string
		empty : string
		reload : string
	}
	fundingPanel : {
		rate : string
		period : string
		nextCountdown : string
		noChart : string
		settleTime : string
		rateCol : string
		empty7d : string
	}
	book : {
		orderBook : string
		trades : string
		priceQuote : string
		amountBase : string
		totalBase : string
		time : string
		buy : string
		sell : string
		buyRatio : string
		sellRatio : string
		noTrades : string
	}
	margin : { cross : string; split : string; experience : string }
	amountUnit : { lots : string; usdt : string }
	leverage : { adjustTitle : string }
	order : {
		limit : string
		market : string
		conditional : string
		condMarket : string
		condLimit : string
		available : string
		maxOpen : string
		triggerPriceLabel : string
		priceLabel : string
		latestBtn : string
		marketExe : string
		condMarketExe : string
		qtyLabel : string
		transferTitle : string
		openLong : string
		openShort : string
		contractInfoTitle : string
		indexSource : string
		marginCoin : string
		maxLeverage : string
		maintMargin : string
		openFee : string
		closeFee : string
		contractValue : string
		minOrder : string
		maxOrder : string
	}
	placeholders : {
		searchPair : string
		triggerPrice : string
		price : string
		amount : string
	}
	bottom : {
		positions : string
		openOrders : string
		historyOrders : string
		historyPositions : string
		tradeDetails : string
		fundingFlow : string
		assets : string
		closeAllPositions : string
		cancelAllOrders : string
		loginPromptOr : string
		registerNow : string
		startTrading : string
	}
	table : {
		contract : string
		dirLeverage : string
		openPrice : string
		markPrice : string
		positionSize : string
		margin : string
		marginRate : string
		unrealizedPnl : string
		roe : string
		liqPrice : string
		openTime : string
		action : string
		type : string
		orderPrice : string
		entrustPriceHist : string
		triggerPrice : string
		orderAmt : string
		filled : string
		tpPrice : string
		slPrice : string
		time : string
		orderTime : string
		fillTime : string
		profitUsdt : string
		tradedVol : string
		closeAvg : string
		profitRate : string
		closeTime : string
		directionOpenClose : string
		dealPrice : string
		fee : string
		fundType : string
		amount : string
		coin : string
		settlementTime : string
		fundingRate : string
		totalBal : string
		availMargin : string
		usedMargin : string
		unrealized : string
		spotWalletBal : string
		fundTransfer : string
		avgOpenPrice : string
		feeHint : string
		estimatedPnlRow : string
		triggerUsdt : string
		orderPriceUsdt : string
		openAvgUsdt : string
		closeAvgUsdt : string
		tpUsdt : string
		slUsdt : string
		marginUsdtBracket : string
		notionalUsdt : string
		estLiqPx : string
		profitBracketUsdt : string
		entrustVolCoin : string
		filledVolCoin : string
		closeAvail : string
		markPriceBtn : string
	}
	empty : {
		noPositions : string
		noOrders : string
		noHistPositions : string
		noHistOrders : string
		noTradeRecords : string
		noFunding : string
	}
	modal : {
		confirmDefaultTitle : string
		positionDetailTitle : string
		orderDetailTitle : string
		histPositionDetailTitle : string
		histOrderDetailTitle : string
		closePositionTitlePrefix : string
		modifyTpSl : string
		setTpSl : string
		posQtyLabel : string
		currentTpSlSection : string
		modifyToSection : string
		setPricesSection : string
		tpTriggerLabel : string
		tpHintOptionalClear : string
		slTriggerLabel : string
		slHintOptionalClear : string
		placeholderTpTrigger : string
		placeholderSlTrigger : string
		confirmCloseBtn : string
		ok : string
		closeTypeLiquidation : string
		tpBadge : string
		slBadge : string
		tpPriceWord : string
		slPriceWord : string
		volLabel : string
		marginSplitMode : string
		directionLabel : string
		entrustTypeLabel : string
		leverageLabel : string
	}
	actions : {
		tpSl : string
		reverse : string
		close : string
		marketCloseAll : string
		cancelOrder : string
	}
	positionRow : {
		hintCross : string
		hintExperience : string
	}
	errors : {
		enterTriggerPrice : string
		enterPrice : string
		priceNotReadyConvert : string
		invalidQtyCheckMin : string
		priceNotReadyRetry : string
		enterQty : string
		qtyExceedAvail : string
		closeFailed : string
		modifyTpSlFailed : string
		txFallback : string
	}
	confirm : {
		reverseTitle : string
		reverseBody : string
		cancelAllTitle : string
		cancelAllBody : string
		closeAllTitle : string
		closeAllBody : string
		sideLongWord : string
		sideShortWord : string
	}
	directions : {
		long : string
		short : string
		openLong : string
		openShort : string
		closeShort : string
		closeLong : string
		openTag : string
		closeTag : string
	}
	orderTypes : {
		limit : string
		plan : string
		takeProfit : string
		stopLoss : string
		marketShort : string
	}
	orderStatus : {
		filled : string
		open : string
		cancelled : string
		failed : string
	}
	closeTypes : {
		market : string
		oneClick : string
		reverseOpen : string
		tpSl : string
		liquidation : string
		admin : string
	}
	fundingTx : Record<string, string>
}

const fundingTxZh : Record<string, string> = {
	'0': '充值',
	'1': '提现',
	'2': '转账',
	'3': '币币交易',
	'4': '法币买入',
	'5': '法币卖出',
	'6': '签到奖励',
	'7': '推广奖励',
	'8': '合约跟单奖励',
	'9': '投票',
	'10': '人工充值',
	'11': '配对',
	'12': '交易奖励',
	'13': 'CTC买入',
	'14': 'CTC卖出',
	'15': '红包发出',
	'16': '红包领取',
	'17': '提现码提现',
	'18': '提现码充值',
	'19': '永续合约手续费',
	'20': '永续合约盈利',
	'21': '永续合约亏损',
	'22': '期权合约失败',
	'23': '期权合约手续费',
	'24': '期权合约奖金',
	'25': '合约返佣',
	'26': '合约资金费率',
	'27': '永续合约爆仓',
	'28': '活动手续费',
	'29': '活动盈利',
	'30': '活动亏损',
	'31': '活动返佣',
	'32': '平级奖励',
	'33': '平台手续费收入',
	'34': '秒合约失败',
	'35': '秒合约奖金',
	'36': '理财利息',
	'37': '合约跟单手续费',
	'38': '合约跟单盈利',
	'39': '合约跟单亏损',
	'40': '合约跟单分润',
	'41': '合约跟单返佣',
	'42': '跟单资金费率',
	'47': '体验金提现',
	'49': '质押',
	'50': '质押解冻释放',
	'51': '空投奖励',
	'52': '划入质押钱包',
	'53': '质押钱包划出',
}

const fundingTxEn : Record<string, string> = {
	'0': 'Deposit',
	'1': 'Withdrawal',
	'2': 'Transfer',
	'3': 'Spot trade',
	'4': 'Fiat buy',
	'5': 'Fiat sell',
	'6': 'Check-in reward',
	'7': 'Referral reward',
	'8': 'Copy-trading reward',
	'9': 'Vote',
	'10': 'Manual deposit',
	'11': 'Pairing',
	'12': 'Trading reward',
	'13': 'CTC buy',
	'14': 'CTC sell',
	'15': 'Red packet sent',
	'16': 'Red packet received',
	'17': 'Withdrawal code payout',
	'18': 'Withdrawal code deposit',
	'19': 'Perp trading fee',
	'20': 'Perp profit',
	'21': 'Perp loss',
	'22': 'Option failure',
	'23': 'Option fee',
	'24': 'Option bonus',
	'25': 'Contract rebate',
	'26': 'Funding fee',
	'27': 'Perp liquidation',
	'28': 'Campaign fee',
	'29': 'Campaign profit',
	'30': 'Campaign loss',
	'31': 'Campaign rebate',
	'32': 'Peer reward',
	'33': 'Platform fee income',
	'34': 'Quick contract failure',
	'35': 'Quick contract bonus',
	'36': 'Wealth interest',
	'37': 'Copy-trading fee',
	'38': 'Copy-trading profit',
	'39': 'Copy-trading loss',
	'40': 'Copy-trading profit share',
	'41': 'Copy-trading rebate',
	'42': 'Copy funding fee',
	'47': 'Bonus withdrawal',
	'49': 'Staking',
	'50': 'Staking unlock release',
	'51': 'Airdrop reward',
	'52': 'Transfer to staking wallet',
	'53': 'Transfer from staking wallet',
}

const fundingTw : Record<string, string> = {
	'0': '儲值',
	'1': '提現',
	'2': '轉帳',
	'3': '幣幣交易',
	'4': '法幣買入',
	'5': '法幣賣出',
	'6': '簽到獎勵',
	'7': '推廣獎勵',
	'8': '合約跟單獎勵',
	'9': '投票',
	'10': '人工儲值',
	'11': '配對',
	'12': '交易獎勵',
	'13': 'CTC買入',
	'14': 'CTC賣出',
	'15': '紅包發出',
	'16': '紅包領取',
	'17': '提現碼提現',
	'18': '提現碼充值',
	'19': '永續合約手續費',
	'20': '永續合約盈利',
	'21': '永續合約虧損',
	'22': '選擇權合約失敗',
	'23': '選擇權合約手續費',
	'24': '選擇權合約獎金',
	'25': '合約返佣',
	'26': '合約資金費率',
	'27': '永續合約爆倉',
	'28': '活動手續費',
	'29': '活動盈利',
	'30': '活動虧損',
	'31': '活動返佣',
	'32': '平級獎勵',
	'33': '平台手續費收入',
	'34': '秒合約失敗',
	'35': '秒合約獎金',
	'36': '理財利息',
	'37': '合約跟單手續費',
	'38': '合約跟單盈利',
	'39': '合約跟單虧損',
	'40': '合約跟單分潤',
	'41': '合約跟單返佣',
	'42': '跟單資金費率',
	'47': '體驗金提現',
	'49': '質押',
	'50': '質押解凍釋放',
	'51': '空投獎勵',
	'52': '劃入質押錢包',
	'53': '質押錢包劃出',
}

const fundingTxKo : Record<string, string> = {
	'0': '입금',
	'1': '출금',
	'2': '이체',
	'3': '현물 거래',
	'4': '법정화폐 매수',
	'5': '법정화폐 매도',
	'6': '출석 보상',
	'7': '추천 보상',
	'8': '카피 트레이딩 보상',
	'9': '투표',
	'10': '수동 입금',
	'11': '페어링',
	'12': '거래 보상',
	'13': 'CTC 매수',
	'14': 'CTC 매도',
	'15': '홍바오 발송',
	'16': '홍바오 수령',
	'17': '출금 코드 출금',
	'18': '출금 코드 입금',
	'19': '영구 계약 수수료',
	'20': '영구 계약 수익',
	'21': '영구 계약 손실',
	'22': '옵션 실패',
	'23': '옵션 수수료',
	'24': '옵션 보너스',
	'25': '계약 리베이트',
	'26': '펀딩비',
	'27': '영구 계약 청산',
	'28': '이벤트 수수료',
	'29': '이벤트 수익',
	'30': '이벤트 손실',
	'31': '이벤트 리베이트',
	'32': '동급 보상',
	'33': '플랫폼 수수료 수입',
	'34': '초단기 계약 실패',
	'35': '초단기 계약 보너스',
	'36': '재테크 이자',
	'37': '카피 트레이딩 수수료',
	'38': '카피 트레이딩 수익',
	'39': '카피 트레이딩 손실',
	'40': '카피 트레이딩 분배',
	'41': '카피 트레이딩 리베이트',
	'42': '카피 펀딩비',
	'47': '체험금 출금',
	'49': '스테이킹',
	'50': '스테이킹 잠금 해제',
	'51': '에어드롭 보상',
	'52': '스테이킹 지갑 입금',
	'53': '스테이킹 지갑 출금',
}

const fundingTxJa : Record<string, string> = {
	'0': '入金',
	'1': '出金',
	'2': '振替',
	'3': '現物取引',
	'4': '法定通貨購入',
	'5': '法定通貨売却',
	'6': 'チェックイン報酬',
	'7': '紹介報酬',
	'8': 'コピートレード報酬',
	'9': '投票',
	'10': '手動入金',
	'11': 'ペアリング',
	'12': '取引報酬',
	'13': 'CTC購入',
	'14': 'CTC売却',
	'15': 'お年玉送信',
	'16': 'お年玉受取',
	'17': '出金コード出金',
	'18': '出金コード入金',
	'19': '無期限契約手数料',
	'20': '無期限契約利益',
	'21': '無期限契約損失',
	'22': 'オプション失敗',
	'23': 'オプション手数料',
	'24': 'オプションボーナス',
	'25': '契約リベート',
	'26': '資金調達率',
	'27': '無期限契約強制決済',
	'28': 'キャンペーン手数料',
	'29': 'キャンペーン利益',
	'30': 'キャンペーン損失',
	'31': 'キャンペーンリベート',
	'32': '同級報酬',
	'33': 'プラットフォーム手数料収入',
	'34': '秒契約失敗',
	'35': '秒契約ボーナス',
	'36': '運用利息',
	'37': 'コピートレード手数料',
	'38': 'コピートレード利益',
	'39': 'コピートレード損失',
	'40': 'コピートレード分配',
	'41': 'コピートレードリベート',
	'42': 'コピー資金調達率',
	'47': '体験金出金',
	'49': 'ステーキング',
	'50': 'ステーキング解除',
	'51': 'エアドロップ報酬',
	'52': 'ステーキングウォレット入金',
	'53': 'ステーキングウォレット出金',
}

const fundingTxHi : Record<string, string> = {
	'0': 'जमा',
	'1': 'निकासी',
	'2': 'ट्रांसफर',
	'3': 'स्पॉट ट्रेड',
	'4': 'फिएट खरीद',
	'5': 'फिएट बिक्री',
	'6': 'चेक-इन इनाम',
	'7': 'रेफरल इनाम',
	'8': 'कॉपी ट्रेडिंग इनाम',
	'9': 'वोट',
	'10': 'मैन्युअल जमा',
	'11': 'पेयरिंग',
	'12': 'ट्रेडिंग इनाम',
	'13': 'CTC खरीद',
	'14': 'CTC बिक्री',
	'15': 'रेड पैकेट भेजा',
	'16': 'रेड पैकेट प्राप्त',
	'17': 'निकासी कोड भुगतान',
	'18': 'निकासी कोड जमा',
	'19': 'परपेचुअल ट्रेडिंग शुल्क',
	'20': 'परपेचुअल लाभ',
	'21': 'परपेचुअल हानि',
	'22': 'ऑप्शन विफल',
	'23': 'ऑप्शन शुल्क',
	'24': 'ऑप्शन बोनस',
	'25': 'कॉन्ट्रैक्ट रिबेट',
	'26': 'फंडिंग शुल्क',
	'27': 'परपेचुअल लिक्विडेशन',
	'28': 'अभियान शुल्क',
	'29': 'अभियान लाभ',
	'30': 'अभियान हानि',
	'31': 'अभियान रिबेट',
	'32': 'सहकर्मी इनाम',
	'33': 'प्लेटफॉर्म शुल्क आय',
	'34': 'त्वरित कॉन्ट्रैक्ट विफल',
	'35': 'त्वरित कॉन्ट्रैक्ट बोनस',
	'36': 'वेल्थ ब्याज',
	'37': 'कॉपी ट्रेडिंग शुल्क',
	'38': 'कॉपी ट्रेडिंग लाभ',
	'39': 'कॉपी ट्रेडिंग हानि',
	'40': 'कॉपी ट्रेडिंग लाभांश',
	'41': 'कॉपी ट्रेडिंग रिबेट',
	'42': 'कॉपी फंडिंग शुल्क',
	'47': 'बोनस निकासी',
	'49': 'स्टेकिंग',
	'50': 'स्टेकिंग अनलॉक रिलीज',
	'51': 'एयरड्रॉप इनाम',
	'52': 'स्टेकिंग वॉलेट में ट्रांसफर',
	'53': 'स्टेकिंग वॉलेट से ट्रांसफर',
}

const fundingTxId : Record<string, string> = {
	'0': 'Deposit',
	'1': 'Penarikan',
	'2': 'Transfer',
	'3': 'Perdagangan spot',
	'4': 'Beli fiat',
	'5': 'Jual fiat',
	'6': 'Hadiah check-in',
	'7': 'Hadiah referral',
	'8': 'Hadiah copy trading',
	'9': 'Voting',
	'10': 'Deposit manual',
	'11': 'Pairing',
	'12': 'Hadiah trading',
	'13': 'Beli CTC',
	'14': 'Jual CTC',
	'15': 'Angpao terkirim',
	'16': 'Angpao diterima',
	'17': 'Penarikan kode',
	'18': 'Deposit kode',
	'19': 'Biaya perdagangan perpetual',
	'20': 'Laba perpetual',
	'21': 'Rugi perpetual',
	'22': 'Opsi gagal',
	'23': 'Biaya opsi',
	'24': 'Bonus opsi',
	'25': 'Rebate kontrak',
	'26': 'Biaya funding',
	'27': 'Likuidasi perpetual',
	'28': 'Biaya kampanye',
	'29': 'Laba kampanye',
	'30': 'Rugi kampanye',
	'31': 'Rebate kampanye',
	'32': 'Hadiah sejawat',
	'33': 'Pendapatan biaya platform',
	'34': 'Kontrak cepat gagal',
	'35': 'Bonus kontrak cepat',
	'36': 'Bunga wealth',
	'37': 'Biaya copy trading',
	'38': 'Laba copy trading',
	'39': 'Rugi copy trading',
	'40': 'Bagi hasil copy trading',
	'41': 'Rebate copy trading',
	'42': 'Biaya funding copy',
	'47': 'Penarikan bonus',
	'49': 'Staking',
	'50': 'Pembukaan staking',
	'51': 'Hadiah airdrop',
	'52': 'Transfer ke dompet staking',
	'53': 'Transfer dari dompet staking',
}

const fundingTxEs : Record<string, string> = {
	'0': 'Depósito',
	'1': 'Retiro',
	'2': 'Transferencia',
	'3': 'Operación al contado',
	'4': 'Compra fiat',
	'5': 'Venta fiat',
	'6': 'Recompensa por inicio de sesión',
	'7': 'Recompensa por referido',
	'8': 'Recompensa por copy trading',
	'9': 'Votación',
	'10': 'Depósito manual',
	'11': 'Emparejamiento',
	'12': 'Recompensa por operación',
	'13': 'Compra CTC',
	'14': 'Venta CTC',
	'15': 'Sobre rojo enviado',
	'16': 'Sobre rojo recibido',
	'17': 'Pago por código de retiro',
	'18': 'Depósito por código de retiro',
	'19': 'Comisión de perpetuos',
	'20': 'Beneficio de perpetuos',
	'21': 'Pérdida de perpetuos',
	'22': 'Opción fallida',
	'23': 'Comisión de opción',
	'24': 'Bono de opción',
	'25': 'Reembolso de contrato',
	'26': 'Comisión de financiación',
	'27': 'Liquidación de perpetuos',
	'28': 'Comisión de campaña',
	'29': 'Beneficio de campaña',
	'30': 'Pérdida de campaña',
	'31': 'Reembolso de campaña',
	'32': 'Recompensa de igual nivel',
	'33': 'Ingreso por comisión de plataforma',
	'34': 'Contrato rápido fallido',
	'35': 'Bono de contrato rápido',
	'36': 'Interés de inversión',
	'37': 'Comisión de copy trading',
	'38': 'Beneficio de copy trading',
	'39': 'Pérdida de copy trading',
	'40': 'Participación en beneficios de copy trading',
	'41': 'Reembolso de copy trading',
	'42': 'Comisión de financiación de copy',
	'47': 'Retiro de bono',
	'49': 'Staking',
	'50': 'Liberación de staking',
	'51': 'Recompensa de airdrop',
	'52': 'Transferencia a monedero de staking',
	'53': 'Transferencia desde monedero de staking',
}

// 俄语
const fundingTxRu : Record<string, string> = {
	'0': 'Депозит',
	'1': 'Вывод',
	'2': 'Перевод',
	'3': 'Спот-торговля',
	'4': 'Покупка фиата',
	'5': 'Продажа фиата',
	'6': 'Награда за посещение',
	'7': 'Реферальная награда',
	'8': 'Награда за копи-трейдинг',
	'9': 'Голосование',
	'10': 'Ручной депозит',
	'11': 'Сопоставление',
	'12': 'Торговая награда',
	'13': 'Покупка CTC',
	'14': 'Продажа CTC',
	'15': 'Красный конверт отправлен',
	'16': 'Красный конверт получен',
	'17': 'Вывод по коду',
	'18': 'Депозит по коду',
	'19': 'Комиссия за бессрочный контракт',
	'20': 'Прибыль по бессрочному контракту',
	'21': 'Убыток по бессрочному контракту',
	'22': 'Опцион не выполнен',
	'23': 'Комиссия за опцион',
	'24': 'Бонус за опцион',
	'25': 'Ребейт по контракту',
	'26': 'Фандинг-сбор',
	'27': 'Ликвидация бессрочного контракта',
	'28': 'Комиссия за кампанию',
	'29': 'Прибыль по кампании',
	'30': 'Убыток по кампании',
	'31': 'Ребейт по кампании',
	'32': 'Награда равного уровня',
	'33': 'Доход от платформенных комиссий',
	'34': 'Моментальный контракт не выполнен',
	'35': 'Бонус моментального контракта',
	'36': 'Проценты по вкладам',
	'37': 'Комиссия за копи-трейдинг',
	'38': 'Прибыль от копи-трейдинга',
	'39': 'Убыток от копи-трейдинга',
	'40': 'Доля прибыли копи-трейдинга',
	'41': 'Ребейт копи-трейдинга',
	'42': 'Фандинг-сбор копи-трейдинга',
	'47': 'Вывод бонусов',
	'49': 'Стейкинг',
	'50': 'Разблокировка стейкинга',
	'51': 'Бонус за аэродроп',
	'52': 'Перевод в кошелек стейкинга',
	'53': 'Перевод из кошелька стейкинга',
}

// 葡萄牙语
const fundingTxPt : Record<string, string> = {
	'0': 'Depósito',
	'1': 'Saque',
	'2': 'Transferência',
	'3': 'Negociação à vista',
	'4': 'Compra de fiat',
	'5': 'Venda de fiat',
	'6': 'Recompensa de check-in',
	'7': 'Recompensa de indicação',
	'8': 'Recompensa de copy trading',
	'9': 'Votação',
	'10': 'Depósito manual',
	'11': 'Emparelhamento',
	'12': 'Recompensa de negociação',
	'13': 'Compra CTC',
	'14': 'Venda CTC',
	'15': 'Pacote vermelho enviado',
	'16': 'Pacote vermelho recebido',
	'17': 'Saque por código',
	'18': 'Depósito por código',
	'19': 'Taxa de contrato perpétuo',
	'20': 'Lucro de contrato perpétuo',
	'21': 'Prejuízo de contrato perpétuo',
	'22': 'Opção falhou',
	'23': 'Taxa de opção',
	'24': 'Bônus de opção',
	'25': 'Reembolso de contrato',
	'26': 'Taxa de financiamento',
	'27': 'Liquidação de contrato perpétuo',
	'28': 'Taxa de campanha',
	'29': 'Lucro de campanha',
	'30': 'Prejuízo de campanha',
	'31': 'Reembolso de campanha',
	'32': 'Recompensa de mesmo nível',
	'33': 'Renda de taxa de plataforma',
	'34': 'Contrato rápido falhou',
	'35': 'Bônus de contrato rápido',
	'36': 'Juros de investimento',
	'37': 'Taxa de copy trading',
	'38': 'Lucro de copy trading',
	'39': 'Prejuízo de copy trading',
	'40': 'Participação nos lucros de copy trading',
	'41': 'Reembolso de copy trading',
	'42': 'Taxa de financiamento de copy trading',
	'47': 'Saque de bônus',
	'49': 'Staking',
	'50': 'Liberação de staking',
	'51': 'Recompensa de airdrop',
	'52': 'Transferência para carteira de staking',
	'53': 'Transferência da carteira de staking',
}

// 德语
const fundingTxDe : Record<string, string> = {
	'0': 'Einzahlung',
	'1': 'Auszahlung',
	'2': 'Überweisung',
	'3': 'Spot-Handel',
	'4': 'Fiat-Kauf',
	'5': 'Fiat-Verkauf',
	'6': 'Check-in-Belohnung',
	'7': 'Empfehlungsbelohnung',
	'8': 'Copy-Trading-Belohnung',
	'9': 'Abstimmung',
	'10': 'Manuelle Einzahlung',
	'11': 'Paarung',
	'12': 'Handelsbelohnung',
	'13': 'CTC-Kauf',
	'14': 'CTC-Verkauf',
	'15': 'Rotumschlag gesendet',
	'16': 'Rotumschlag erhalten',
	'17': 'Auszahlung per Code',
	'18': 'Einzahlung per Code',
	'19': 'Ewiger Vertragsgebühr',
	'20': 'Ewiger Vertragsgewinn',
	'21': 'Ewiger Vertragsverlust',
	'22': 'Option fehlgeschlagen',
	'23': 'Optionsgebühr',
	'24': 'Optionsbonus',
	'25': 'Vertragsrabatt',
	'26': 'Finanzierungsgebühr',
	'27': 'Ewige Vertragsliquidation',
	'28': 'Kampagnengebühr',
	'29': 'Kampagnengewinn',
	'30': 'Kampagnenverlust',
	'31': 'Kampagnenrabatt',
	'32': 'Gleichstufige Belohnung',
	'33': 'Plattformgebühreinnahmen',
	'34': 'Schnellvertrag fehlgeschlagen',
	'35': 'Schnellvertragsbonus',
	'36': 'Vermögenszinsen',
	'37': 'Copy-Trading-Gebühr',
	'38': 'Copy-Trading-Gewinn',
	'39': 'Copy-Trading-Verlust',
	'40': 'Copy-Trading-Gewinnbeteiligung',
	'41': 'Copy-Trading-Rabatt',
	'42': 'Copy-Finanzierungsgebühr',
	'47': 'Bonusauszahlung',
	'49': 'Staking',
	'50': 'Staking-Freigabe',
	'51': 'Airdrop-Belohnung',
	'52': 'Überweisung zum Staking-Wallet',
	'53': 'Überweisung vom Staking-Wallet',
}

// 法语
const fundingTxFr : Record<string, string> = {
	'0': 'Dépôt',
	'1': 'Retrait',
	'2': 'Transfert',
	'3': 'Trading au comptant',
	'4': 'Achat de fiat',
	'5': 'Vente de fiat',
	'6': 'Récompense de connexion',
	'7': 'Récompense de parrainage',
	'8': 'Récompense de copy trading',
	'9': 'Vote',
	'10': 'Dépôt manuel',
	'11': 'Appariement',
	'12': 'Récompense de trading',
	'13': 'Achat CTC',
	'14': 'Vente CTC',
	'15': 'Paquet rouge envoyé',
	'16': 'Paquet rouge reçu',
	'17': 'Retrait par code',
	'18': 'Dépôt par code',
	'19': 'Frais de contrat perpétuel',
	'20': 'Profit de contrat perpétuel',
	'21': 'Perte de contrat perpétuel',
	'22': 'Option échouée',
	'23': 'Frais d\'option',
	'24': 'Bonus d\'option',
	'25': 'Remboursement de contrat',
	'26': 'Frais de financement',
	'27': 'Liquidation de contrat perpétuel',
	'28': 'Frais de campagne',
	'29': 'Profit de campagne',
	'30': 'Perte de campagne',
	'31': 'Remboursement de campagne',
	'32': 'Récompense de même niveau',
	'33': 'Revenu de frais de plateforme',
	'34': 'Contrat rapide échoué',
	'35': 'Bonus de contrat rapide',
	'36': 'Intérêts de placement',
	'37': 'Frais de copy trading',
	'38': 'Profit de copy trading',
	'39': 'Perte de copy trading',
	'40': 'Partage des bénéfices de copy trading',
	'41': 'Remboursement de copy trading',
	'42': 'Frais de financement de copy trading',
	'47': 'Retrait de bonus',
	'49': 'Staking',
	'50': 'Libération de staking',
	'51': 'Récompense d\'airdrop',
	'52': 'Transfert vers portefeuille de staking',
	'53': 'Transfert depuis portefeuille de staking',
}

// 土耳其语
const fundingTxTr : Record<string, string> = {
	'0': 'Yatırma',
	'1': 'Çekme',
	'2': 'Transfer',
	'3': 'Spot işlem',
	'4': 'Fiat alımı',
	'5': 'Fiat satımı',
	'6': 'Giriş ödülü',
	'7': 'Referans ödülü',
	'8': 'Kopya işlem ödülü',
	'9': 'Oylama',
	'10': 'Manuel yatırma',
	'11': 'Eşleştirme',
	'12': 'İşlem ödülü',
	'13': 'CTC alımı',
	'14': 'CTC satımı',
	'15': 'Kırmızı zarf gönderildi',
	'16': 'Kırmızı zarf alındı',
	'17': 'Kod ile çekme',
	'18': 'Kod ile yatırma',
	'19': 'Sürekli sözleşme ücreti',
	'20': 'Sürekli sözleşme karı',
	'21': 'Sürekli sözleşme zararı',
	'22': 'Seçenek başarısız',
	'23': 'Seçenek ücreti',
	'24': 'Seçenek bonusu',
	'25': 'Sözleşme indirimi',
	'26': 'Finansman ücreti',
	'27': 'Sürekli sözleşme likidasyonu',
	'28': 'Kampanya ücreti',
	'29': 'Kampanya karı',
	'30': 'Kampanya zararı',
	'31': 'Kampanya indirimi',
	'32': 'Eş düzey ödülü',
	'33': 'Platform ücreti geliri',
	'34': 'Hızlı sözleşme başarısız',
	'35': 'Hızlı sözleşme bonusu',
	'36': 'Servet faizi',
	'37': 'Kopya işlem ücreti',
	'38': 'Kopya işlem karı',
	'39': 'Kopya işlem zararı',
	'40': 'Kopya işlem kar payı',
	'41': 'Kopya işlem indirimi',
	'42': 'Kopya finansman ücreti',
	'47': 'Bonus çekme',
	'49': 'Staking',
	'50': 'Staking serbest bırakma',
	'51': 'Hava düşü ödülü',
	'52': 'Staking cüzdanına transfer',
	'53': 'Staking cüzdanından transfer',
}

// 越南语
const fundingTxVi : Record<string, string> = {
	'0': 'Nạp tiền',
	'1': 'Rút tiền',
	'2': 'Chuyển khoản',
	'3': 'Giao dịch spot',
	'4': 'Mua fiat',
	'5': 'Bán fiat',
	'6': 'Thưởng đăng nhập',
	'7': 'Thưởng giới thiệu',
	'8': 'Thưởng copy trading',
	'9': 'Bình chọn',
	'10': 'Nạp tiền thủ công',
	'11': 'Ghép cặp',
	'12': 'Thưởng giao dịch',
	'13': 'Mua CTC',
	'14': 'Bán CTC',
	'15': 'Thư đỏ đã gửi',
	'16': 'Thư đỏ đã nhận',
	'17': 'Rút tiền bằng mã',
	'18': 'Nạp tiền bằng mã',
	'19': 'Phí hợp đồng vĩnh viễn',
	'20': 'Lợi nhuận hợp đồng vĩnh viễn',
	'21': 'Thua lỗ hợp đồng vĩnh viễn',
	'22': 'Lựa chọn thất bại',
	'23': 'Phí lựa chọn',
	'24': 'Thưởng lựa chọn',
	'25': 'Hoàn phí hợp đồng',
	'26': 'Phí tài trợ',
	'27': 'Thanh lý hợp đồng vĩnh viễn',
	'28': 'Phí chiến dịch',
	'29': 'Lợi nhuận chiến dịch',
	'30': 'Thua lỗ chiến dịch',
	'31': 'Hoàn phí chiến dịch',
	'32': 'Thưởng cấp bằng',
	'33': 'Thu nhập phí nền tảng',
	'34': 'Hợp đồng nhanh thất bại',
	'35': 'Thưởng hợp đồng nhanh',
	'36': 'Lãi suất tài chính',
	'37': 'Phí copy trading',
	'38': 'Lợi nhuận copy trading',
	'39': 'Thua lỗ copy trading',
	'40': 'Chia sẻ lợi nhuận copy trading',
	'41': 'Hoàn phí copy trading',
	'42': 'Phí tài trợ copy trading',
	'47': 'Rút thưởng',
	'49': 'Staking',
	'50': 'Giải phóng staking',
	'51': 'Thưởng airdrop',
	'52': 'Chuyển đến ví staking',
	'53': 'Chuyển từ ví staking',
}

function buildZhCN() : FuturesPageMessages {
	return {
		perpetual: '永续合约',
		perpetualTag: '永续',
		pairSearchPlaceholder: '搜索',
		pairSearchTag:{
			oneType: '加密货币',
			twoType: '大宗商品',
			threeType: '贵金属',
			fourType: '外汇',
		},
		pairEmpty: '无匹配结果',
		stats: {
			change24h: '24h涨跌',
			markPrice: '标记价格',
			high24h: '24h最高价',
			low24h: '24h最低价',
			volume24h: '24h成交量',
			fundingCountdown: '资金费率 / 倒计时',
		},
		mobileTabs: { chart: '行情', trade: '交易' },
		chartSub: { chart: '图表', coinInfo: '币种资料', fundingHistory: '历史资金费率' },
		tf: {
			m1: '1分',
			m5: '5分',
			m15: '15分',
			m30: '30分',
			h1: '1小时',
			h4: '4小时',
			d1: '1日',
			w1: '1周',
			mo1: '1月',
			mo3: '3月',
		},
		chartTools: { fullscreen: '全屏', alert: '提醒' },
		draw: {
			cursor: '光标',
			trend: '趋势线',
			hline: '水平线',
			ray: '射线',
			channel: '通道线',
			fib: '斐波那契回撤',
			text: '文字标注',
			clearAll: '删除所有标注',
			zoomOut: '缩小',
		},
		ohlcv: {
			open: '开',
			high: '高',
			low: '低',
			close: '收',
			volume: '成交量',
			changePct: '涨幅',
			amplitude: '振幅',
		},
		coinInfo: {
			marketCap: '市值',
			circulating: '流通量',
			issuePrice: '发行价',
			ath: '历史最高',
			athDate: 'ATH 日期',
			whitepaper: '白皮书',
			empty: '暂无币种资料',
			reload: '重新加载',
		},
		fundingPanel: {
			rate: '资金费率',
			period: '结算周期',
			nextCountdown: '下次结算倒计时',
			noChart: '暂无图表数据',
			settleTime: '结算时间',
			rateCol: '资金费率',
			empty7d: '暂无近7天数据',
		},
		book: {
			orderBook: '订单簿',
			trades: '最新成交',
			priceQuote: '价格(USDT)',
			amountBase: '数量({base})',
			totalBase: '总量({base})',
			time: '时间',
			buy: '买',
			sell: '卖',
			buyRatio: '买 {n}%',
			sellRatio: '{n}% 卖',
			noTrades: '暂无成交数据',
		},
		margin: { cross: '全仓', split: '分仓', experience: '体验金' },
		amountUnit: { lots: '张', usdt: 'USDT' },
		leverage: { adjustTitle: '调整杠杆' },
		order: {
			limit: '限价',
			market: '市价',
			conditional: '条件委托',
			condMarket: '市价委托',
			condLimit: '限价委托',
			available: '可用',
			maxOpen: '最大可开',
			triggerPriceLabel: '触发价 ({q})',
			priceLabel: '价格 ({q})',
			latestBtn: '最新',
			marketExe: '市价成交',
			condMarketExe: '触发后市价成交',
			qtyLabel: '数量 ({u})',
			transferTitle: '划转',
			openLong: '开多',
			openShort: '开空',
			contractInfoTitle: '合约信息',
			indexSource: '指数来源',
			marginCoin: '保证金币种',
			maxLeverage: '最大杠杆',
			maintMargin: '维持保证金率',
			openFee: '开仓手续费',
			closeFee: '平仓手续费',
			contractValue: '合约面值',
			minOrder: '最小下单量',
			maxOrder: '最大下单量',
		},
		placeholders: { searchPair: '搜索', triggerPrice: '请输入触发价', price: '请输入价格', amount: '请输入数量' },
		bottom: {
			positions: '仓位',
			openOrders: '当前委托',
			historyOrders: '历史委托',
			historyPositions: '历史仓位',
			tradeDetails: '成交明细',
			fundingFlow: '资金流水',
			assets: '资产',
			closeAllPositions: '一键平仓',
			cancelAllOrders: '全部撤单',
			loginPromptOr: '或',
			registerNow: '立即注册',
			startTrading: '开始交易',
		},
		table: {
			contract: '合约',
			dirLeverage: '方向/杠杆',
			openPrice: '开仓价',
			markPrice: '标记价',
			positionSize: '持仓量',
			margin: '保证金',
			marginRate: '保证金率',
			unrealizedPnl: '浮动盈亏',
			roe: '收益率',
			liqPrice: '强平价',
			openTime: '开仓时间',
			action: '操作',
			type: '类型',
			orderPrice: '委托价',
			entrustPriceHist: '委托价格',
			triggerPrice: '触发价',
			orderAmt: '委托量',
			filled: '已成交',
			tpPrice: '止盈价',
			slPrice: '止损价',
			time: '时间',
			orderTime: '委托时间',
			fillTime: '成交时间',
			profitUsdt: '收益(USDT)',
			tradedVol: '已成交量',
			closeAvg: '平仓均价',
			profitRate: '收益率',
			closeTime: '平仓时间',
			directionOpenClose: '方向/开平',
			dealPrice: '成交价',
			fee: '手续费',
			fundType: '类型',
			amount: '数量',
			coin: '币种',
			settlementTime: '结算时间',
			fundingRate: '资金费率',
			totalBal: '合约账户总余额',
			availMargin: '可用保证金',
			usedMargin: '已用保证金',
			unrealized: '未实现盈亏',
			spotWalletBal: '可提现账户余额',
			fundTransfer: '资金划转',
			avgOpenPrice: '开仓均价',
			feeHint: '手续费（USDT）',
			estimatedPnlRow: '预计盈亏',
			triggerUsdt: '触发价（USDT）',
			orderPriceUsdt: '委托价（USDT）',
			openAvgUsdt: '开仓均价（USDT）',
			closeAvgUsdt: '平仓均价（USDT）',
			tpUsdt: '止盈价（USDT）',
			slUsdt: '止损价（USDT）',
			marginUsdtBracket: '保证金（USDT）',
			notionalUsdt: '仓位价值（USDT）',
			estLiqPx: '预估强平价',
			profitBracketUsdt: '收益（USDT）',
			entrustVolCoin: '委托量（{base}）',
			filledVolCoin: '已成交量（{base}）',
			closeAvail: '可平:',
			markPriceBtn: '标记价',
		},
		empty: {
			noPositions: '暂无持仓',
			noOrders: '暂无委托',
			noHistPositions: '暂无历史仓位',
			noHistOrders: '暂无历史委托',
			noTradeRecords: '暂无成交记录',
			noFunding: '暂无资金流水',
		},
		modal: {
			confirmDefaultTitle: '请确认',
			positionDetailTitle: '仓位详情',
			orderDetailTitle: '委托详情',
			histPositionDetailTitle: '历史仓位详情',
			histOrderDetailTitle: '历史委托详情',
			closePositionTitlePrefix: '平仓',
			modifyTpSl: '修改止盈止损',
			setTpSl: '设置止盈止损',
			posQtyLabel: '持仓量:',
			currentTpSlSection: '当前止盈止损委托',
			modifyToSection: '修改为',
			setPricesSection: '设置价格',
			tpTriggerLabel: '止盈触发价 ',
			tpHintOptionalClear: '（不填则清除止盈）',
			slTriggerLabel: '止损触发价 ',
			slHintOptionalClear: '（不填则清除止损）',
			placeholderTpTrigger: '输入止盈触发价',
			placeholderSlTrigger: '输入止损触发价',
			confirmCloseBtn: '确认平仓',
			ok: '确定',
			closeTypeLiquidation: '爆仓',
			tpBadge: '止盈',
			slBadge: '止损',
			tpPriceWord: '止盈价 ',
			slPriceWord: '止损价 ',
			volLabel: '数量:',
			marginSplitMode: '全仓/分仓',
			directionLabel: '方向',
			entrustTypeLabel: '委托类型',
			leverageLabel: '杠杆',
		},
		actions: { tpSl: '止盈止损', reverse: '反手', close: '平仓', marketCloseAll: '市价全平', cancelOrder: '撤单' },
		positionRow: { hintCross: '全仓', hintExperience: '体验金' },
		errors: {
			enterTriggerPrice: '请输入触发价',
			enterPrice: '请输入价格',
			priceNotReadyConvert: '价格未就绪，无法换算数量',
			invalidQtyCheckMin: '数量无效，请检查精度与最小下单量',
			priceNotReadyRetry: '价格未就绪，请稍后重试',
			enterQty: '请输入数量',
			qtyExceedAvail: '数量超出可平量',
			closeFailed: '平仓失败',
			modifyTpSlFailed: '修改失败，请稍后重试',
			txFallback: '类型{n}',
		},
		confirm: {
			reverseTitle: '一键反手',
			reverseBody: '确认对 {pair} {side} 仓位执行一键反手吗？',
			cancelAllTitle: '全部撤单',
			cancelAllBody: '确认撤销当前 {n} 个委托吗？',
			closeAllTitle: '一键平仓',
			closeAllBody: '确认对当前 {n} 个持仓执行一键平仓吗？',
			sideLongWord: '做多',
			sideShortWord: '做空',
		},
		directions: {
			long: '做多',
			short: '做空',
			openLong: '开多',
			openShort: '开空',
			closeShort: '平空',
			closeLong: '平多',
			openTag: '开',
			closeTag: '平',
		},
		orderTypes: { limit: '限价', plan: '计划委托', takeProfit: '止盈', stopLoss: '止损', marketShort: '市价' },
		orderStatus: { filled: '已成交', open: '委托中', cancelled: '已撤销', failed: '失败' },
		closeTypes: {
			market: '市价平仓',
			oneClick: '一键平仓',
			reverseOpen: '反向开仓',
			tpSl: '止盈止损',
			liquidation: '爆仓',
			admin: '管理员平仓',
		},
		fundingTx: fundingTxZh,
	}
}

function buildEn() : FuturesPageMessages {
	const b = buildZhCN()
	return {
		...b,
		perpetual: 'Perpetual',
		perpetualTag: 'Perpetual',
		pairSearchPlaceholder: 'Search',
		pairEmpty: 'No matching pairs',
		stats: {
			change24h: '24h Change',
			markPrice: 'Mark',
			high24h: '24h High',
			low24h: '24h Low',
			volume24h: '24h Volume',
			fundingCountdown: 'Funding / Countdown',
		},
		mobileTabs: { chart: 'Chart', trade: 'Trade' },
		chartSub: { chart: 'Chart', coinInfo: 'Coin Info', fundingHistory: 'Funding History' },
		tf: {
			m1: '1m',
			m5: '5m',
			m15: '15m',
			m30: '30m',
			h1: '1h',
			h4: '4h',
			d1: '1d',
			w1: '1w',
			mo1: '1mon',
			mo3: '3mon'
		},
		chartTools: { fullscreen: 'Fullscreen', alert: 'Alerts' },
		draw: {
			cursor: 'Cursor',
			trend: 'Trend line',
			hline: 'Horizontal',
			ray: 'Ray',
			channel: 'Channel',
			fib: 'Fib retracement',
			text: 'Text',
			clearAll: 'Clear drawings',
			zoomOut: 'Zoom out',
		},
		ohlcv: {
			open: 'O',
			high: 'H',
			low: 'L',
			close: 'C',
			volume: 'Volume',
			changePct: 'Change',
			amplitude: 'Range',
		},
		coinInfo: {
			marketCap: 'Market cap',
			circulating: 'Circulating supply',
			issuePrice: 'Issue price',
			ath: 'All-time high',
			athDate: 'ATH date',
			whitepaper: 'Whitepaper',
			empty: 'No coin info',
			reload: 'Reload',
		},
		fundingPanel: {
			rate: 'Funding rate',
			period: 'Settlement period',
			nextCountdown: 'Next countdown',
			noChart: 'No chart data',
			settleTime: 'Settlement',
			rateCol: 'Funding rate',
			empty7d: 'No last-7-days data',
		},
		book: {
			orderBook: 'Order book',
			trades: 'Trades',
			priceQuote: 'Price (USDT)',
			amountBase: 'Amount ({base})',
			totalBase: 'Total ({base})',
			time: 'Time',
			buy: 'Buy',
			sell: 'Sell',
			buyRatio: 'Buy {n}%',
			sellRatio: '{n}% Sell',
			noTrades: 'No trades',
		},
		margin: { cross: 'Cross', split: 'Isolated', experience: 'Bonus' },
		amountUnit: { lots: 'Cont', usdt: 'USDT' },
		leverage: { adjustTitle: 'Adjust leverage' },
		order: {
			limit: 'Limit',
			market: 'Market',
			conditional: 'Conditional',
			condMarket: 'Market conditional',
			condLimit: 'Limit conditional',
			available: 'Available',
			maxOpen: 'Max to open',
			triggerPriceLabel: 'Trigger ({q})',
			priceLabel: 'Price ({q})',
			latestBtn: 'Last',
			marketExe: 'Market',
			condMarketExe: 'Market after trigger',
			qtyLabel: 'Amount ({u})',
			transferTitle: 'Transfer',
			openLong: 'Buy / Long',
			openShort: 'Sell / Short',
			contractInfoTitle: 'Contract info',
			indexSource: 'Index sources',
			marginCoin: 'Margin asset',
			maxLeverage: 'Max leverage',
			maintMargin: 'Maint. margin rate',
			openFee: 'Open fee',
			closeFee: 'Close fee',
			contractValue: 'Contract value',
			minOrder: 'Min order size',
			maxOrder: 'Max order size',
		},
		placeholders: {
			searchPair: 'Search',
			triggerPrice: 'Enter trigger price',
			price: 'Enter price',
			amount: 'Enter amount',
		},
		bottom: {
			positions: 'Positions',
			openOrders: 'Open orders',
			historyOrders: 'Order history',
			historyPositions: 'Position history',
			tradeDetails: 'Trades',
			fundingFlow: 'Funding',
			assets: 'Assets',
			closeAllPositions: 'Close all',
			cancelAllOrders: 'Cancel all',
			loginPromptOr: 'or',
			registerNow: 'Register now',
			startTrading: 'to start trading',
		},
		table: {
			contract: 'Contract',
			dirLeverage: 'Dir./Lev.',
			openPrice: 'Open',
			markPrice: 'Mark',
			positionSize: 'Size',
			margin: 'Margin',
			marginRate: 'Margin ratio',
			unrealizedPnl: 'UPnL',
			roe: 'ROE',
			liqPrice: 'Liq. price',
			openTime: 'Open time',
			action: 'Action',
			type: 'Type',
			orderPrice: 'Price',
			entrustPriceHist: 'Order price',
			triggerPrice: 'Trigger',
			orderAmt: 'Order qty',
			filled: 'Filled',
			tpPrice: 'Take profit',
			slPrice: 'Stop loss',
			time: 'Time',
			orderTime: 'Order time',
			fillTime: 'Fill time',
			profitUsdt: 'P&L (USDT)',
			tradedVol: 'Filled qty',
			closeAvg: 'Close avg.',
			profitRate: 'ROE',
			closeTime: 'Close time',
			directionOpenClose: 'Side/O-C',
			dealPrice: 'Fill price',
			fee: 'Fee',
			fundType: 'Type',
			amount: 'Amount',
			coin: 'Coin',
			settlementTime: 'Settlement',
			fundingRate: 'Funding rate',
			totalBal: 'Futures balance',
			availMargin: 'Available margin',
			usedMargin: 'Used margin',
			unrealized: 'Unrealized P&L',
			spotWalletBal: 'Withdrawable account balance',
			fundTransfer: 'Transfer',
			avgOpenPrice: 'Avg. open',
			feeHint: 'Fee (USDT)',
			estimatedPnlRow: 'Est. P&L',
			triggerUsdt: 'Trigger (USDT)',
			orderPriceUsdt: 'Order price (USDT)',
			openAvgUsdt: 'Avg. entry (USDT)',
			closeAvgUsdt: 'Avg. exit (USDT)',
			tpUsdt: 'TP (USDT)',
			slUsdt: 'SL (USDT)',
			marginUsdtBracket: 'Margin (USDT)',
			notionalUsdt: 'Position value (USDT)',
			estLiqPx: 'Est. liq. price',
			profitBracketUsdt: 'P&L (USDT)',
			entrustVolCoin: 'Order qty ({base})',
			filledVolCoin: 'Filled ({base})',
			closeAvail: 'Closable:',
			markPriceBtn: 'Mark',
		},
		empty: {
			noPositions: 'No positions',
			noOrders: 'No orders',
			noHistPositions: 'No position history',
			noHistOrders: 'No historical orders',
			noTradeRecords: 'No fills',
			noFunding: 'No funding records',
		},
		modal: {
			confirmDefaultTitle: 'Please confirm',
			positionDetailTitle: 'Position detail',
			orderDetailTitle: 'Order detail',
			histPositionDetailTitle: 'Historical position',
			histOrderDetailTitle: 'Historical order',
			closePositionTitlePrefix: 'Close',
			modifyTpSl: 'Edit TP/SL',
			setTpSl: 'Set TP/SL',
			posQtyLabel: 'Size:',
			currentTpSlSection: 'Active TP/SL orders',
			modifyToSection: 'Change to',
			setPricesSection: 'Prices',
			tpTriggerLabel: 'Take-profit trigger ',
			tpHintOptionalClear: '(Leave empty to clear TP)',
			slTriggerLabel: 'Stop-loss trigger ',
			slHintOptionalClear: '(Leave empty to clear SL)',
			placeholderTpTrigger: 'TP trigger price',
			placeholderSlTrigger: 'SL trigger price',
			confirmCloseBtn: 'Confirm close',
			ok: 'OK',
			closeTypeLiquidation: 'Liquidated',
			tpBadge: 'TP',
			slBadge: 'SL',
			tpPriceWord: 'TP ',
			slPriceWord: 'SL ',
			volLabel: 'Qty:',
			marginSplitMode: 'Cross / Isolated',
			directionLabel: 'Side',
			entrustTypeLabel: 'Order type',
			leverageLabel: 'Leverage',
		},
		actions: { tpSl: 'TP/SL', reverse: 'Reverse', close: 'Close', marketCloseAll: 'Market close all', cancelOrder: 'Cancel' },
		positionRow: { hintCross: 'Cross', hintExperience: 'Bonus' },
		errors: {
			enterTriggerPrice: 'Enter trigger price',
			enterPrice: 'Enter price',
			priceNotReadyConvert: 'Price not ready — cannot convert size',
			invalidQtyCheckMin: 'Invalid size — check precision and minimum order',
			priceNotReadyRetry: 'Price not ready, please retry',
			enterQty: 'Enter quantity',
			qtyExceedAvail: 'Qty exceeds closeable amount',
			closeFailed: 'Close failed',
			modifyTpSlFailed: 'Update failed — try later',
			txFallback: 'Type {n}',
		},
		confirm: {
			reverseTitle: 'Reverse position',
			reverseBody: 'Reverse {pair} {side}?',
			cancelAllTitle: 'Cancel all',
			cancelAllBody: 'Cancel {n} orders?',
			closeAllTitle: 'Close all',
			closeAllBody: 'Market-close {n} positions?',
			sideLongWord: 'long',
			sideShortWord: 'short',
		},
		directions: {
			long: 'Long',
			short: 'Short',
			openLong: 'Open long',
			openShort: 'Open short',
			closeShort: 'Close short',
			closeLong: 'Close long',
			openTag: 'O',
			closeTag: 'C',
		},
		orderTypes: { limit: 'Limit', plan: 'Trigger', takeProfit: 'Take profit', stopLoss: 'Stop loss', marketShort: 'Market' },
		orderStatus: { filled: 'Filled', open: 'Open', cancelled: 'Cancelled', failed: 'Failed' },
		closeTypes: {
			market: 'Market close',
			oneClick: 'Bulk close',
			reverseOpen: 'Reverse open',
			tpSl: 'TP/SL',
			liquidation: 'Liquidation',
			admin: 'Admin close',
		},
		fundingTx: fundingTxEn,
	}
}

function buildZhTW() : FuturesPageMessages {
	const cn = buildZhCN()
	return {
		...cn,
		perpetual: '永續合約',
		perpetualTag: '永續',
		pairSearchPlaceholder: '搜尋',
		pairEmpty: '無符合結果',
		stats: {
			change24h: '24h漲跌',
			markPrice: '標記價格',
			high24h: '24h最高價',
			low24h: '24h最低價',
			volume24h: '24h成交量',
			fundingCountdown: '資金費率 / 倒計時',
		},
		mobileTabs: { chart: '行情', trade: '交易' },
		chartSub: { chart: '圖表', coinInfo: '幣種資料', fundingHistory: '歷史資金費率' },
		tf: {
			m1: '1分',
			m5: '5分',
			m15: '15分',
			m30: '30分',
			h1: '1小時',
			h4: '4小時',
			d1: '1日',
			w1: '1週',
			mo1: '1月',
			mo3: '3月'
		},
		chartTools: { fullscreen: '全螢幕', alert: '提醒' },
		draw: {
			cursor: '游標',
			trend: '趨勢線',
			hline: '水平線',
			ray: '射線',
			channel: '通道線',
			fib: '斐波那契回撤',
			text: '文字標註',
			clearAll: '刪除所有標註',
			zoomOut: '縮小',
		},
		ohlcv: { ...cn.ohlcv, volume: '成交量', changePct: '漲幅', amplitude: '振幅' },
		coinInfo: {
			marketCap: '市值',
			circulating: '流通量',
			issuePrice: '發行價',
			ath: '歷史最高',
			athDate: 'ATH 日期',
			whitepaper: '白皮書',
			empty: '暫無幣種資料',
			reload: '重新載入',
		},
		fundingPanel: {
			rate: '資金費率',
			period: '結算週期',
			nextCountdown: '下次結算倒計時',
			noChart: '暫無圖表數據',
			settleTime: '結算時間',
			rateCol: '資金費率',
			empty7d: '暫無近7天數據',
		},
		book: {
			orderBook: '訂單簿',
			trades: '最新成交',
			priceQuote: '價格(USDT)',
			amountBase: '數量({base})',
			totalBase: '總量({base})',
			time: '時間',
			buy: '買',
			sell: '賣',
			buyRatio: '買 {n}%',
			sellRatio: '{n}% 賣',
			noTrades: '暫無成交資料',
		},
		margin: { cross: '全倉', split: '分倉', experience: '體驗金' },
		amountUnit: { lots: '張', usdt: 'USDT' },
		leverage: { adjustTitle: '調整槓桿' },
		order: {
			limit: '限價',
			market: '市價',
			conditional: '條件委託',
			condMarket: '市價委託',
			condLimit: '限價委託',
			available: '可用',
			maxOpen: '最大可開',
			triggerPriceLabel: '觸發價 ({q})',
			priceLabel: '價格 ({q})',
			latestBtn: '最新',
			marketExe: '市價成交',
			condMarketExe: '觸發後市價成交',
			qtyLabel: '數量 ({u})',
			transferTitle: '劃轉',
			openLong: '開多',
			openShort: '開空',
			contractInfoTitle: '合約資訊',
			indexSource: '指數來源',
			marginCoin: '保證金幣種',
			maxLeverage: '最大槓桿',
			maintMargin: '維持保證金率',
			openFee: '開倉手續費',
			closeFee: '平倉手續費',
			contractValue: '合約面值',
			minOrder: '最小下單量',
			maxOrder: '最大下單量',
		},
		placeholders: { searchPair: '搜尋', triggerPrice: '請輸入觸發價', price: '請輸入價格', amount: '請輸入數量' },
		bottom: {
			positions: '倉位',
			openOrders: '當前委託',
			historyOrders: '歷史委託',
			historyPositions: '歷史倉位',
			tradeDetails: '成交明細',
			fundingFlow: '資金流水',
			assets: '資產',
			closeAllPositions: '一鍵平倉',
			cancelAllOrders: '全部撤單',
			loginPromptOr: '或',
			registerNow: '立即註冊',
			startTrading: '開始交易',
		},
		table: {
			contract: '合約',
			dirLeverage: '方向/槓桿',
			openPrice: '開倉價',
			markPrice: '標記價',
			positionSize: '持倉量',
			margin: '保證金',
			marginRate: '保證金率',
			unrealizedPnl: '浮動盈虧',
			roe: '收益率',
			liqPrice: '強平價',
			openTime: '開倉時間',
			action: '操作',
			type: '類型',
			orderPrice: '委託價',
			entrustPriceHist: '委託價格',
			triggerPrice: '觸發價',
			orderAmt: '委託量',
			filled: '已成交',
			tpPrice: '止盈價',
			slPrice: '止損價',
			time: '時間',
			orderTime: '委託時間',
			fillTime: '成交時間',
			profitUsdt: '收益(USDT)',
			tradedVol: '已成交量',
			closeAvg: '平倉均價',
			profitRate: '收益率',
			closeTime: '平倉時間',
			directionOpenClose: '方向/開平',
			dealPrice: '成交價',
			fee: '手續費',
			fundType: '類型',
			amount: '數量',
			coin: '幣種',
			settlementTime: '結算時間',
			fundingRate: '資金費率',
			totalBal: '合約帳戶總餘額',
			availMargin: '可用保證金',
			usedMargin: '已用保證金',
			unrealized: '未實現盈虧',
			spotWalletBal: '可提現帳戶餘額',
			fundTransfer: '資金劃轉',
			avgOpenPrice: '開倉均價',
			feeHint: '手續費（USDT）',
			estimatedPnlRow: '預計盈虧',
			triggerUsdt: '觸發價（USDT）',
			orderPriceUsdt: '委託價（USDT）',
			openAvgUsdt: '開倉均價（USDT）',
			closeAvgUsdt: '平倉均價（USDT）',
			tpUsdt: '止盈價（USDT）',
			slUsdt: '止損價（USDT）',
			marginUsdtBracket: '保證金（USDT）',
			notionalUsdt: '倉位價值（USDT）',
			estLiqPx: '預估強平價',
			profitBracketUsdt: '收益（USDT）',
			entrustVolCoin: '委託量（{base}）',
			filledVolCoin: '已成交量（{base}）',
			closeAvail: '可平:',
			markPriceBtn: '標記價',
		},
		empty: {
			noPositions: '暫無持倉',
			noOrders: '暫無委託',
			noHistPositions: '暫無歷史倉位',
			noHistOrders: '暫無歷史委託',
			noTradeRecords: '暫無成交記錄',
			noFunding: '暫無資金流水',
		},
		modal: {
			confirmDefaultTitle: '請確認',
			positionDetailTitle: '倉位詳情',
			orderDetailTitle: '委託詳情',
			histPositionDetailTitle: '歷史倉位詳情',
			histOrderDetailTitle: '歷史委託詳情',
			closePositionTitlePrefix: '平倉',
			modifyTpSl: '修改止盈止損',
			setTpSl: '設置止盈止損',
			posQtyLabel: '持倉量:',
			currentTpSlSection: '當前止盈止損委託',
			modifyToSection: '修改為',
			setPricesSection: '設置價格',
			tpTriggerLabel: '止盈觸發價 ',
			tpHintOptionalClear: '（不填則清除止盈）',
			slTriggerLabel: '止損觸發價 ',
			slHintOptionalClear: '（不填則清除止損）',
			placeholderTpTrigger: '輸入止盈觸發價',
			placeholderSlTrigger: '輸入止損觸發價',
			confirmCloseBtn: '確認平倉',
			ok: '確定',
			closeTypeLiquidation: '爆倉',
			tpBadge: '止盈',
			slBadge: '止損',
			tpPriceWord: '止盈價 ',
			slPriceWord: '止損價 ',
			volLabel: '數量:',
			marginSplitMode: '全倉/分倉',
			directionLabel: '方向',
			entrustTypeLabel: '委託類型',
			leverageLabel: '槓桿',
		},
		actions: { tpSl: '止盈止損', reverse: '反手', close: '平倉', marketCloseAll: '市價全平', cancelOrder: '撤單' },
		positionRow: { hintCross: '全倉', hintExperience: '體驗金' },
		errors: {
			enterTriggerPrice: '請輸入觸發價',
			enterPrice: '請輸入價格',
			priceNotReadyConvert: '價格未就緒，無法換算數量',
			invalidQtyCheckMin: '數量無效，請檢查精度與最小下單量',
			priceNotReadyRetry: '價格未就緒，請稍後重試',
			enterQty: '請輸入數量',
			qtyExceedAvail: '數量超出可平量',
			closeFailed: '平倉失敗',
			modifyTpSlFailed: '修改失敗，請稍後重試',
			txFallback: '類型{n}',
		},
		confirm: {
			reverseTitle: '一鍵反手',
			reverseBody: '確認對 {pair} {side} 倉位執行一鍵反手嗎？',
			cancelAllTitle: '全部撤單',
			cancelAllBody: '確認撤銷當前 {n} 個委託嗎？',
			closeAllTitle: '一鍵平倉',
			closeAllBody: '確認對當前 {n} 個持倉執行一鍵平倉嗎？',
			sideLongWord: '做多',
			sideShortWord: '做空',
		},
		directions: {
			long: '做多',
			short: '做空',
			openLong: '開多',
			openShort: '開空',
			closeShort: '平空',
			closeLong: '平多',
			openTag: '開',
			closeTag: '平',
		},
		orderTypes: { limit: '限價', plan: '計畫委託', takeProfit: '止盈', stopLoss: '止損', marketShort: '市價' },
		orderStatus: { filled: '已成交', open: '委託中', cancelled: '已撤銷', failed: '失敗' },
		closeTypes: {
			market: '市價平倉',
			oneClick: '一鍵平倉',
			reverseOpen: '反向開倉',
			tpSl: '止盈止損',
			liquidation: '爆倉',
			admin: '管理員平倉',
		},
		fundingTx: fundingTw,
	}
}

function buildKo() : FuturesPageMessages {
	return deepMerge(buildEn(), { ...koUiOverlay, fundingTx: fundingTxKo }) as FuturesPageMessages
}

function buildJa() : FuturesPageMessages {
	return deepMerge(buildEn(), { ...jaUiOverlay, fundingTx: fundingTxJa }) as FuturesPageMessages
}

function buildHi() : FuturesPageMessages {
	return deepMerge(buildEn(), { ...hiUiOverlay, fundingTx: fundingTxHi }) as FuturesPageMessages
}

function buildId() : FuturesPageMessages {
	return deepMerge(buildEn(), { ...idUiOverlay, fundingTx: fundingTxId }) as FuturesPageMessages
}

function buildEs() : FuturesPageMessages {
	return deepMerge(buildEn(), { ...esUiOverlay, fundingTx: fundingTxEs }) as FuturesPageMessages
}

function buildRu() : FuturesPageMessages {
	return deepMerge(buildEn(), { ...ruUiOverlay, fundingTx: fundingTxRu }) as FuturesPageMessages
}

function buildPt() : FuturesPageMessages {
	return deepMerge(buildEn(), { ...ptUiOverlay, fundingTx: fundingTxPt }) as FuturesPageMessages
}

function buildDe() : FuturesPageMessages {
	return deepMerge(buildEn(), { ...deUiOverlay, fundingTx: fundingTxDe }) as FuturesPageMessages
}

function buildFr() : FuturesPageMessages {
	return deepMerge(buildEn(), { ...frUiOverlay, fundingTx: fundingTxFr }) as FuturesPageMessages
}

function buildTr() : FuturesPageMessages {
	return deepMerge(buildEn(), { ...trUiOverlay, fundingTx: fundingTxTr }) as FuturesPageMessages
}

function buildVi() : FuturesPageMessages {
	return deepMerge(buildEn(), { ...viUiOverlay, fundingTx: fundingTxVi }) as FuturesPageMessages
}

export const futuresPageByLocale = {
	'zh-CN': buildZhCN(),
	'zh-TW': buildZhTW(),
	en: buildEn(),
	ko: buildKo(),
	ja: buildJa(),
	hi: buildHi(),
	id: buildId(),
	es: buildEs(),
	ru: buildRu(),
	pt: buildPt(),
	de: buildDe(),
	fr: buildFr(),
	tr: buildTr(),
	vi: buildVi(),
} as const