mirror of
https://github.com/laoxong/nofx.git
synced 2026-06-04 09:58:22 +08:00
feat: add i18n support for candidate coins warnings (#516)
- Add 13 translation keys for candidate coins warnings in both English and Chinese - Update App.tsx to use t() function for all warning text - Update AITradersPage.tsx to use t() function for signal source warnings - Ensure proper internationalization for all user-facing messages Co-authored-by: tinkle-community <tinklefund@gmail.com>
This commit is contained in:
+11
-11
@@ -1044,12 +1044,12 @@ function DecisionCard({
|
||||
? '#F6465D'
|
||||
: '#848E9C'
|
||||
}}>
|
||||
候选币种: {decision.candidate_coins?.length || 0}
|
||||
{t('candidateCoins', language)}: {decision.candidate_coins?.length || 0}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 候选币种为0的警告提示 */}
|
||||
{/* Candidate Coins Warning */}
|
||||
{decision.candidate_coins && decision.candidate_coins.length === 0 && (
|
||||
<div
|
||||
className="text-sm rounded px-4 py-3 mb-3 flex items-start gap-3"
|
||||
@@ -1061,21 +1061,21 @@ function DecisionCard({
|
||||
>
|
||||
<AlertTriangle size={16} className="flex-shrink-0 mt-0.5" />
|
||||
<div className="flex-1">
|
||||
<div className="font-semibold mb-1">⚠️ 候选币种数量为 0</div>
|
||||
<div className="font-semibold mb-1">⚠️ {t('candidateCoinsZeroWarning', language)}</div>
|
||||
<div className="text-xs space-y-1" style={{ color: '#848E9C' }}>
|
||||
<div>可能原因:</div>
|
||||
<div>{t('possibleReasons', language)}</div>
|
||||
<ul className="list-disc list-inside space-y-0.5 ml-2">
|
||||
<li>币种池API未配置或无法访问(请检查信号源设置)</li>
|
||||
<li>API连接超时或返回数据为空</li>
|
||||
<li>未配置自定义币种且API获取失败</li>
|
||||
<li>{t('coinPoolApiNotConfigured', language)}</li>
|
||||
<li>{t('apiConnectionTimeout', language)}</li>
|
||||
<li>{t('noCustomCoinsAndApiFailed', language)}</li>
|
||||
</ul>
|
||||
<div className="mt-2">
|
||||
<strong>解决方案:</strong>
|
||||
<strong>{t('solutions', language)}</strong>
|
||||
</div>
|
||||
<ul className="list-disc list-inside space-y-0.5 ml-2">
|
||||
<li>在交易员配置中设置自定义币种列表</li>
|
||||
<li>或者配置正确的币种池API地址</li>
|
||||
<li>或者禁用"使用币种池"和"使用OI Top"选项</li>
|
||||
<li>{t('setCustomCoinsInConfig', language)}</li>
|
||||
<li>{t('orConfigureCorrectApiUrl', language)}</li>
|
||||
<li>{t('orDisableCoinPoolOptions', language)}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -676,18 +676,17 @@ export function AITradersPage({ onTraderSelect }: AITradersPageProps) {
|
||||
/>
|
||||
<div className="flex-1">
|
||||
<div className="font-semibold mb-1" style={{ color: '#F6465D' }}>
|
||||
⚠️ 信号源未配置
|
||||
⚠️ {t('signalSourceNotConfigured', language)}
|
||||
</div>
|
||||
<div className="text-sm" style={{ color: '#848E9C' }}>
|
||||
<p className="mb-2">
|
||||
您有交易员启用了"使用币种池"或"使用OI Top",但尚未配置信号源API地址。
|
||||
这将导致<strong style={{ color: '#F6465D' }}>候选币种数量为0</strong>,交易员无法正常工作。
|
||||
{t('signalSourceWarningMessage', language)}
|
||||
</p>
|
||||
<p>
|
||||
<strong>解决方案:</strong>
|
||||
<strong>{t('solutions', language)}</strong>
|
||||
</p>
|
||||
<ul className="list-disc list-inside space-y-1 ml-2 mt-1">
|
||||
<li>点击"📡 信号源"按钮配置API地址</li>
|
||||
<li>点击"📡 {t('signalSource', language)}"按钮配置API地址</li>
|
||||
<li>或在交易员配置中禁用"使用币种池"和"使用OI Top"</li>
|
||||
<li>或在交易员配置中设置自定义币种列表</li>
|
||||
</ul>
|
||||
@@ -700,7 +699,7 @@ export function AITradersPage({ onTraderSelect }: AITradersPageProps) {
|
||||
color: '#000',
|
||||
}}
|
||||
>
|
||||
立即配置信号源
|
||||
{t('configureSignalSourceNow', language)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -472,6 +472,21 @@ export const translations = {
|
||||
loginRegisterPrompt:
|
||||
'Please login or register to access the full AI trading platform',
|
||||
registerNewAccount: 'Register New Account',
|
||||
|
||||
// Candidate Coins Warnings
|
||||
candidateCoins: 'Candidate Coins',
|
||||
candidateCoinsZeroWarning: 'Candidate Coins Count is 0',
|
||||
possibleReasons: 'Possible Reasons:',
|
||||
coinPoolApiNotConfigured: 'Coin pool API not configured or inaccessible (check signal source settings)',
|
||||
apiConnectionTimeout: 'API connection timeout or returned empty data',
|
||||
noCustomCoinsAndApiFailed: 'No custom coins configured and API fetch failed',
|
||||
solutions: 'Solutions:',
|
||||
setCustomCoinsInConfig: 'Set custom coin list in trader configuration',
|
||||
orConfigureCorrectApiUrl: 'Or configure correct coin pool API address',
|
||||
orDisableCoinPoolOptions: 'Or disable "Use Coin Pool" and "Use OI Top" options',
|
||||
signalSourceNotConfigured: 'Signal Source Not Configured',
|
||||
signalSourceWarningMessage: 'You have traders that enabled "Use Coin Pool" or "Use OI Top", but signal source API address is not configured yet. This will cause candidate coins count to be 0, and traders cannot work properly.',
|
||||
configureSignalSourceNow: 'Configure Signal Source Now',
|
||||
},
|
||||
zh: {
|
||||
// Header
|
||||
@@ -908,6 +923,21 @@ export const translations = {
|
||||
accessNofxPlatform: '访问 NOFX 平台',
|
||||
loginRegisterPrompt: '请选择登录或注册以访问完整的 AI 交易平台',
|
||||
registerNewAccount: '注册新账号',
|
||||
|
||||
// Candidate Coins Warnings
|
||||
candidateCoins: '候选币种',
|
||||
candidateCoinsZeroWarning: '候选币种数量为 0',
|
||||
possibleReasons: '可能原因:',
|
||||
coinPoolApiNotConfigured: '币种池API未配置或无法访问(请检查信号源设置)',
|
||||
apiConnectionTimeout: 'API连接超时或返回数据为空',
|
||||
noCustomCoinsAndApiFailed: '未配置自定义币种且API获取失败',
|
||||
solutions: '解决方案:',
|
||||
setCustomCoinsInConfig: '在交易员配置中设置自定义币种列表',
|
||||
orConfigureCorrectApiUrl: '或者配置正确的币种池API地址',
|
||||
orDisableCoinPoolOptions: '或者禁用"使用币种池"和"使用OI Top"选项',
|
||||
signalSourceNotConfigured: '信号源未配置',
|
||||
signalSourceWarningMessage: '您有交易员启用了"使用币种池"或"使用OI Top",但尚未配置信号源API地址。这将导致候选币种数量为0,交易员无法正常工作。',
|
||||
configureSignalSourceNow: '立即配置信号源',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user