fix(i18n): 补齐九语翻译并修复国际化检查

补齐历史缺译并统一整句插值。九语覆盖 100%,静态检查及 713 项单测通过。
This commit is contained in:
zhanjunhao
2026-11-17 14:10:25 +08:00
parent 936ece78ff
commit ac9bbfd472
146 changed files with 16591 additions and 11007 deletions
+14 -7
View File
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import {
Eye as ActionEye,
Check as ActionCheck,
@@ -256,7 +257,9 @@ const AdminInvoice = () => {
return (
displayName ||
username || (
<span className='text-gray-400'>User#{record.user_id}</span>
<span className='text-gray-400'>
{t('用户 #{{id}}', { id: record.user_id })}
</span>
)
);
},
@@ -574,12 +577,16 @@ const AdminInvoice = () => {
{detailData.topup_list && detailData.topup_list.length > 0 && (
<div>
<Text className='text-sm text-gray-500 mb-2 block'>
{t('关联充值记录')} ({detailData.topup_list.length} {t('笔')}
,{t('合计')} ¥
{detailData.topup_list
.reduce((s, item) => s + (item.money || 0), 0)
.toFixed(2)}
)
<Trans
t={t}
i18nKey='关联充值记录 ({{length}} 笔,合计 ¥{{value}})'
values={{
length: detailData.topup_list.length,
value: detailData.topup_list
.reduce((s, item) => s + (item.money || 0), 0)
.toFixed(2),
}}
/>
</Text>
<Table
dataSource={detailData.topup_list}
+17 -7
View File
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import {
Check as ActionCheck,
Copy as ActionCopy,
@@ -280,7 +281,11 @@ const AdminOrder = () => {
if (displayName || username) {
return displayName || username;
}
return <span className='text-gray-400'>User#{record.user_id}</span>;
return (
<span className='text-gray-400'>
{t('用户 #{{id}}', { id: record.user_id })}
</span>
);
},
},
{ title: t('用户ID'), dataIndex: 'user_id', width: 70 },
@@ -326,12 +331,17 @@ const AdminOrder = () => {
{formatUSDMinor(record.provider_net_amount_minor)}
</div>
<div>
{t('结算状态')}:{' '}
{t(
payPalSettlementStateMap[record.paypal_settlement_state] ||
record.paypal_settlement_state ||
'未知',
)}
<Trans
t={t}
i18nKey='结算状态: {{label}}'
values={{
label: t(
payPalSettlementStateMap[record.paypal_settlement_state] ||
record.paypal_settlement_state ||
'未知',
),
}}
/>
</div>
</div>
);
+21 -6
View File
@@ -17,6 +17,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import {
Bot as ActionBot,
ArrowRight as ActionArrowRight,
@@ -144,7 +146,9 @@ const StatusPill = ({ status }) => {
);
};
const BetaBadge = () => <span className='brain-beta'>BETA</span>;
const BetaBadge = () => (
<span className='brain-beta'>{I18N_TECHNICAL_TEXT.BETA}</span>
);
const expertPresentation = {
'management-report': { icon: BriefcaseBusiness, tone: 'is-sage' },
@@ -2031,7 +2035,8 @@ const CloudBrain = ({ organization = false, orgId = 0, canManage = false }) => {
<div className='brain-skill-list' aria-label={t('审核技能')}>
{(expert.skills || []).map((skill) => (
<span key={skill.id} title={skill.description}>
<CheckCircle2 size={12} /> {skill.name} · v
<CheckCircle2 size={12} /> {skill.name}{' '}
{I18N_TECHNICAL_TEXT.VERSION_PREFIX}
{skill.version}
</span>
))}
@@ -2306,7 +2311,11 @@ const CloudBrain = ({ organization = false, orgId = 0, canManage = false }) => {
{safeDate(activeRun.created_at, i18n.language)}
</span>
<span>
{t('计费状态')}: {t(activeRun.billing_status)}
<Trans
t={t}
i18nKey='计费状态: {{label}}'
values={{ label: t(activeRun.billing_status) }}
/>
</span>
{activeRun.started_at > 0 &&
activeRun.finished_at > 0 && (
@@ -2335,7 +2344,8 @@ const CloudBrain = ({ organization = false, orgId = 0, canManage = false }) => {
{(expertById.get(activeRun.expert_id)?.skills || []).map(
(skill) => (
<small key={skill.id}>
{skill.name} · v{skill.version} · {skill.license}
{skill.name} {I18N_TECHNICAL_TEXT.VERSION_PREFIX}
{skill.version} · {skill.license}
</small>
),
)}
@@ -2533,7 +2543,11 @@ const CloudBrain = ({ organization = false, orgId = 0, canManage = false }) => {
{runErrorMessages[activeRun.error_code] &&
failureReason.reason && (
<p className='brain-error-reason'>
{t('失败原因')}:{t(failureReason.reason)}
<Trans
t={t}
i18nKey='失败原因:{{label}}'
values={{ label: t(failureReason.reason) }}
/>
</p>
)}
{(failureReason.raw || activeRun.error_code) && (
@@ -2644,7 +2658,8 @@ const CloudBrain = ({ organization = false, orgId = 0, canManage = false }) => {
{Math.ceil(
Number(runDetail.artifact.size_bytes || 0) / 1024,
)}{' '}
KiB · {t('恶意软件扫描已通过')}
{I18N_TECHNICAL_TEXT.KIB_SEPARATOR}{' '}
{t('恶意软件扫描已通过')}
</span>
</div>
<Button
+25 -19
View File
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import { writeClipboardText } from '../../helpers/clipboard';
import React, { useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -124,7 +125,7 @@ const Docs = () => {
<div className='docs-feature-icon blue'>
<i className='fas fa-brain'></i>
</div>
<h3>Claude Code</h3>
<h3>{I18N_TECHNICAL_TEXT.CLAUDE_CODE}</h3>
<p>
{t(
'Anthropic 官方 CLI 工具,强大的代码理解和生成能力,擅长复杂架构设计和代码重构',
@@ -150,7 +151,7 @@ const Docs = () => {
<div className='docs-feature-icon green'>
<i className='fas fa-code'></i>
</div>
<h3>CodeX</h3>
<h3>{I18N_TECHNICAL_TEXT.CODEX}</h3>
<p>
{t(
'OpenAI 编程助手,专注代码补全和问题解决,快速响应,适合日常编码',
@@ -164,7 +165,8 @@ const Docs = () => {
<i className='fas fa-check'></i> {t('问题诊断')}
</span>
<span className='docs-tag'>
<i className='fas fa-check'></i> API {t('友好')}
<i className='fas fa-check'></i> {I18N_TECHNICAL_TEXT.API}{' '}
{t('友好')}
</span>
</div>
</div>
@@ -176,7 +178,7 @@ const Docs = () => {
<div className='docs-feature-icon purple'>
<i className='fas fa-gem'></i>
</div>
<h3>Gemini CLI</h3>
<h3>{I18N_TECHNICAL_TEXT.GEMINI_CLI}</h3>
<p>
{t(
'Google 多模态 AI 工具,支持多种输入类型,与 Google Cloud 深度集成',
@@ -315,7 +317,7 @@ const Docs = () => {
<i className='fas fa-brain'></i>
</div>
<div>
<h1>Claude Code</h1>
<h1>{I18N_TECHNICAL_TEXT.CLAUDE_CODE}</h1>
<p>
{t('Anthropic 官方命令行工具,强大的代码理解和生成能力')}
</p>
@@ -416,7 +418,7 @@ claude-code "创建一个 React 组件"`}</code>
<i className='fas fa-code'></i>
</div>
<div>
<h1>CodeX</h1>
<h1>{I18N_TECHNICAL_TEXT.CODEX}</h1>
<p>{t('OpenAI 编程助手,专注代码补全和问题解决')}</p>
</div>
</div>
@@ -493,7 +495,7 @@ codex "写一个排序算法"`}</code>
<i className='fas fa-gem'></i>
</div>
<div>
<h1>Gemini CLI</h1>
<h1>{I18N_TECHNICAL_TEXT.GEMINI_CLI}</h1>
<p>{t('Google 多模态 AI 工具,与 Google Cloud 深度集成')}</p>
</div>
</div>
@@ -586,21 +588,21 @@ gemini "分析这段代码的性能问题"`}</code>
onClick={() => setActiveTool('claude')}
>
<i className='fas fa-brain'></i>
<span>Claude Code</span>
<span>{I18N_TECHNICAL_TEXT.CLAUDE_CODE}</span>
</button>
<button
className={`docs-tool-btn ${activeTool === 'codex' ? 'active' : ''}`}
onClick={() => setActiveTool('codex')}
>
<i className='fas fa-code'></i>
<span>CodeX</span>
<span>{I18N_TECHNICAL_TEXT.CODEX}</span>
</button>
<button
className={`docs-tool-btn ${activeTool === 'gemini' ? 'active' : ''}`}
onClick={() => setActiveTool('gemini')}
>
<i className='fas fa-gem'></i>
<span>Gemini CLI</span>
<span>{I18N_TECHNICAL_TEXT.GEMINI_CLI}</span>
</button>
</div>
@@ -611,21 +613,21 @@ gemini "分析这段代码的性能问题"`}</code>
onClick={() => setActiveOS('windows')}
>
<i className='fab fa-windows'></i>
<span>Windows</span>
<span>{I18N_TECHNICAL_TEXT.WINDOWS}</span>
</button>
<button
className={`docs-os-btn ${activeOS === 'linux' ? 'active' : ''}`}
onClick={() => setActiveOS('linux')}
>
<i className='fab fa-linux'></i>
<span>Linux</span>
<span>{I18N_TECHNICAL_TEXT.LINUX}</span>
</button>
<button
className={`docs-os-btn ${activeOS === 'macos' ? 'active' : ''}`}
onClick={() => setActiveOS('macos')}
>
<i className='fab fa-apple'></i>
<span>macOS</span>
<span>{I18N_TECHNICAL_TEXT.MACOS}</span>
</button>
</div>
@@ -864,15 +866,17 @@ claude-code doctor`
<th>{t('特性')}</th>
<th>
<span className='docs-tool-badge claude'>
Claude Code
{I18N_TECHNICAL_TEXT.CLAUDE_CODE}
</span>
</th>
<th>
<span className='docs-tool-badge codex'>CodeX</span>
<span className='docs-tool-badge codex'>
{I18N_TECHNICAL_TEXT.CODEX}
</span>
</th>
<th>
<span className='docs-tool-badge gemini'>
Gemini CLI
{I18N_TECHNICAL_TEXT.GEMINI_CLI}
</span>
</th>
</tr>
@@ -950,7 +954,8 @@ claude-code doctor`
<div className='docs-comparison-grid'>
<div className='docs-comparison-card'>
<h4>
<i className='fas fa-brain'></i> Claude Code
<i className='fas fa-brain'></i>{' '}
{I18N_TECHNICAL_TEXT.CLAUDE_CODE}
</h4>
<p>{t('适合需要深度代码理解和复杂架构设计的场景')}</p>
<ul>
@@ -967,7 +972,7 @@ claude-code doctor`
</div>
<div className='docs-comparison-card'>
<h4>
<i className='fas fa-code'></i> CodeX
<i className='fas fa-code'></i> {I18N_TECHNICAL_TEXT.CODEX}
</h4>
<p>{t('适合日常编码和快速问题解决')}</p>
<ul>
@@ -984,7 +989,8 @@ claude-code doctor`
</div>
<div className='docs-comparison-card'>
<h4>
<i className='fas fa-gem'></i> Gemini CLI
<i className='fas fa-gem'></i>{' '}
{I18N_TECHNICAL_TEXT.GEMINI_CLI}
</h4>
<p>{t('适合需要多模态能力和云服务集成的场景')}</p>
<ul>
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../../../i18n/technicalText.js';
import {
Wallet as ActionWallet,
RotateCcw as ActionRotateCcw,
@@ -716,9 +717,13 @@ const ImageGenerationForm = ({ creation }) => {
</Dropdown>
)}
<span className='flex items-center gap-1 text-[10px] text-gray-400'>
{IS_MAC ? <Command size={10} /> : <span>Ctrl</span>}
{IS_MAC ? (
<Command size={10} />
) : (
<span>{I18N_TECHNICAL_TEXT.CTRL}</span>
)}
<span>+</span>
<span>Enter</span>
<span>{I18N_TECHNICAL_TEXT.ENTER}</span>
<span>{t('生成')}</span>
</span>
</div>
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import {
Wallet as ActionWallet,
Play as ActionPlay,
@@ -377,10 +378,11 @@ const VideoPreviewPanel = ({
{t('使用提示')}
</div>
<div style={{ fontSize: '13px', lineHeight: '1.8' }}>
• {t('详细的提示词能获得更好的效果')}
<br />• {t('建议使用高质量的首帧图片')}
<br />• {t('视频生成可能需要 1-3 分钟')}
<br />• {t('可在任务队列中查看历史记录')}
<Trans
t={t}
i18nKey='• 详细的提示词能获得更好的效果<part0/>• 建议使用高质量的首帧图片<part1/>• 视频生成可能需要 1-3 分钟<part2/>• 可在任务队列中查看历史记录'
components={{ part0: <br />, part1: <br />, part2: <br /> }}
/>
</div>
</div>
}
@@ -533,19 +535,27 @@ const VideoPreviewPanel = ({
type='tertiary'
style={{ fontSize: windowWidth > 768 ? '12px' : '10px' }}
>
{t('模型')}:{' '}
{taskData.model ||
displayTask.properties?.upstream_model_name ||
displayTask.properties?.origin_model_name ||
(typeof selectedModel === 'object'
? selectedModel?.model_name
: selectedModel)}{' '}
| {t('时长')}:{' '}
{taskData.duration || displayTask.properties?.duration || '-'}
s | {t('分辨率')}:{' '}
{taskData.resolution ||
displayTask.properties?.resolution ||
'-'}
<Trans
t={t}
i18nKey='模型: {{value}} | 时长: {{value2}}s | 分辨率: {{value3}}'
values={{
value:
taskData.model ||
displayTask.properties?.upstream_model_name ||
displayTask.properties?.origin_model_name ||
(typeof selectedModel === 'object'
? selectedModel?.model_name
: selectedModel),
value2:
taskData.duration ||
displayTask.properties?.duration ||
'-',
value3:
taskData.resolution ||
displayTask.properties?.resolution ||
'-',
}}
/>
</Text>
</div>
</Space>
@@ -700,7 +710,7 @@ const VideoPreviewPanel = ({
</Title>
<img
src={formData.imagePreview || formData.image}
alt='Preview'
alt={t('预览')}
style={{
maxWidth: '100%',
maxHeight: windowWidth > 1024 ? '500px' : '350px',
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../../i18n/technicalText.js';
import {
ChevronRight as ActionChevronRight,
ChevronLeft as ActionChevronLeft,
@@ -201,7 +202,7 @@ const ExperienceSidebar = ({ unread }) => {
</span>
{item.beta && (
<span className='shrink-0 rounded-full border border-orange-300/70 bg-orange-50 px-1.5 py-0.5 font-mono text-[8px] font-bold tracking-wider text-orange-700'>
BETA
{I18N_TECHNICAL_TEXT.BETA}
</span>
)}
{unreadCount > 0 ? (
+2 -1
View File
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import React, { useContext } from 'react';
import { Navigate, useLocation, useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
@@ -115,7 +116,7 @@ const MobileBottomNav = ({ currentPath, navigate, isAvailable, unread }) => {
</span>
{item.beta && (
<span className='absolute top-0.5 right-[18%] rounded-full bg-orange-500 px-1 font-mono text-[7px] font-bold tracking-wide text-white'>
BETA
{I18N_TECHNICAL_TEXT.BETA}
</span>
)}
{item.unread > 0 && !isActive ? (
+14 -14
View File
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import {
RefreshCw as ActionRefreshCw,
Plus as ActionPlus,
@@ -1542,7 +1543,7 @@ const ExpertPlatform = () => {
<div className='expert-card-title'>
<h3>{item.model_name}</h3>
<span className='expert-card-key'>
channel #{item.channel_id}
{t('渠道 #{{id}}', { id: item.channel_id })}
</span>
</div>
<Tag
@@ -2514,19 +2515,18 @@ const ExpertPlatform = () => {
{selectedCase?.workload_type === 'agent-worker' &&
reconciliationRunBilling[selectedCase?.workload_id] && (
<Text type='warning'>
{t(
'“实际配额”按任务全生命周期总额录入(含先前各步已结算部分)。当前已结算',
)}
:{' '}
{
reconciliationRunBilling[selectedCase.workload_id]
.effective_quota
}{' '}
· {t('预留')}:{' '}
{
reconciliationRunBilling[selectedCase.workload_id]
.reserved_quota
}
<Trans
t={t}
i18nKey='“实际配额”按任务全生命周期总额录入(含先前各步已结算部分)。当前已结算: {{effective_quota}} · 预留: {{reserved_quota}}'
values={{
effective_quota:
reconciliationRunBilling[selectedCase.workload_id]
.effective_quota,
reserved_quota:
reconciliationRunBilling[selectedCase.workload_id]
.reserved_quota,
}}
/>
</Text>
)}
{selectedCase?.workload_type === 'connector-write' && (
+4 -4
View File
@@ -467,7 +467,7 @@ const Home = () => {
<Users className='text-white' size={26} />
</div>
<span className='text-sm font-bold text-slate-700 dark:text-slate-200 bg-white/50 dark:bg-black/50 px-3 py-1 rounded-full backdrop-blur-sm'>
Client
{t('客户端')}
</span>
</div>
@@ -483,7 +483,7 @@ const Home = () => {
<div className='absolute -inset-1 rounded-2xl border border-white/40 animate-pulse'></div>
</div>
<span className='text-sm font-bold text-brand-deep dark:text-brand-from bg-white/50 dark:bg-black/50 px-3 py-1 rounded-full backdrop-blur-sm'>
Gateway
{t('网关')}
</span>
</div>
@@ -548,10 +548,10 @@ const Home = () => {
</p>
<div className='flex gap-2'>
<span className='px-3 py-1 rounded-full bg-white/60 dark:bg-slate-800/60 border border-blue-100 dark:border-blue-900/30 text-xs text-blue-700 dark:text-blue-300'>
Context Window 128k+
{t('上下文窗口 128k+')}
</span>
<span className='px-3 py-1 rounded-full bg-white/60 dark:bg-slate-800/60 border border-blue-100 dark:border-blue-900/30 text-xs text-blue-700 dark:text-blue-300'>
Function Calling
{t('函数调用')}
</span>
</div>
</div>
+20 -9
View File
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import {
EyeOff as ActionEyeOff,
Eye as ActionEye,
@@ -401,7 +402,7 @@ const ModelsDrawer = ({ visible, onClose, token, t }) => {
const copyModel = async (model) => {
try {
await writeClipboardText(model);
showSuccess(t('已复制') + ': ' + model);
showSuccess(t('已复制: {{model}}', { model: model }));
} catch {
showError(t('复制失败,请手动复制'));
}
@@ -577,14 +578,16 @@ const KeyManagement = ({ embedded = false }) => {
content: (
<div>
<div className='flex items-center gap-2 mb-2'>
<span className='text-lg'>📋</span>
<span className='text-lg'>
{I18N_TECHNICAL_TEXT.CLIPBOARD_ICON}
</span>
<span className='font-semibold'>{t('密钥卡片')}</span>
</div>
<div className='text-sm text-gray-600 dark:text-gray-300'>
{t('每张卡片展示密钥的状态、名称和剩余额度')}
</div>
<div className='mt-2 text-xs text-gray-400'>
💡 {t('绿色状态点表示密钥已启用')}
{I18N_TECHNICAL_TEXT.TIP_ICON} {t('绿色状态点表示密钥已启用')}
</div>
</div>
),
@@ -595,14 +598,16 @@ const KeyManagement = ({ embedded = false }) => {
content: (
<div>
<div className='flex items-center gap-2 mb-2'>
<span className='text-lg'>📋</span>
<span className='text-lg'>
{I18N_TECHNICAL_TEXT.CLIPBOARD_ICON}
</span>
<span className='font-semibold'>{t('复制密钥')}</span>
</div>
<div className='text-sm text-gray-600 dark:text-gray-300'>
{t('点击复制完整密钥(sk-xxx 格式)')}
</div>
<div className='mt-2 p-2 bg-gray-100 dark:bg-neutral-800 rounded text-xs font-mono'>
sk-xxxxxxxxxxxxxxxx
{I18N_TECHNICAL_TEXT.SK_XXXXXXXXXXXXXXXX}
</div>
</div>
),
@@ -614,14 +619,17 @@ const KeyManagement = ({ embedded = false }) => {
content: (
<div>
<div className='flex items-center gap-2 mb-2'>
<span className='text-lg'>⚙️</span>
<span className='text-lg'>
{I18N_TECHNICAL_TEXT.SETTINGS_ICON}
</span>
<span className='font-semibold'>{t('管理密钥')}</span>
</div>
<div className='text-sm text-gray-600 dark:text-gray-300'>
{t('编辑密钥名称、额度、过期时间等设置')}
</div>
<div className='mt-3 text-xs text-gray-400'>
💡 {t('点击右上角问号可随时重新查看引导')}
{I18N_TECHNICAL_TEXT.TIP_ICON}{' '}
{t('点击右上角问号可随时重新查看引导')}
</div>
</div>
),
@@ -636,7 +644,9 @@ const KeyManagement = ({ embedded = false }) => {
content: (
<div>
<div className='flex items-center gap-2 mb-2'>
<span className='text-lg'>🚀</span>
<span className='text-lg'>
{I18N_TECHNICAL_TEXT.ROCKET_ICON}
</span>
<span className='font-semibold'>
{t('开始创建您的第一个密钥')}
</span>
@@ -645,7 +655,8 @@ const KeyManagement = ({ embedded = false }) => {
{t('点击这里创建密钥,创建后可用于调用 API 服务')}
</div>
<div className='mt-3 p-2 bg-brand/5 dark:bg-brand-deep/20 rounded-lg text-xs text-brand-deep dark:text-brand-from'>
💡 {t('创建密钥后,可再次点击右上角问号查看完整操作指引')}
{I18N_TECHNICAL_TEXT.TIP_ICON}{' '}
{t('创建密钥后,可再次点击右上角问号查看完整操作指引')}
</div>
</div>
),
+3 -2
View File
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import React from 'react';
import WeeLogo from '../components/common/logo/WeeLogo';
import { Card, Typography } from '@/components/ui';
@@ -111,7 +112,7 @@ const LogoShowcase = () => {
1. {t('导入组件')}
</Title>
<div className='p-4 bg-slate-100 dark:bg-zinc-700 rounded font-mono text-sm overflow-x-auto'>
{"import WeeLogo from './components/common/logo/WeeLogo';"}
{I18N_TECHNICAL_TEXT.LOGO_IMPORT_EXAMPLE}
</div>
</div>
@@ -133,7 +134,7 @@ const LogoShowcase = () => {
3. {t('直接使用')}
</Title>
<div className='p-4 bg-slate-100 dark:bg-zinc-700 rounded font-mono text-sm overflow-x-auto'>
{'<WeeLogo style="tech" size={48} />'}
{I18N_TECHNICAL_TEXT.LOGO_USAGE_EXAMPLE}
</div>
</div>
</div>
+15 -6
View File
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import React, { useState, useEffect } from 'react';
import { Card, Row, Col, Table, Spin } from '@/components/ui';
import {
@@ -315,7 +316,7 @@ const AdminMonitor = () => {
borderRadius: '2px',
}}
/>
<span>Prompt</span>
<span>{I18N_TECHNICAL_TEXT.PROMPT}</span>
</div>
<div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
<div
@@ -326,7 +327,7 @@ const AdminMonitor = () => {
borderRadius: '2px',
}}
/>
<span>Completion</span>
<span>{I18N_TECHNICAL_TEXT.COMPLETION}</span>
</div>
</div>
</div>
@@ -409,7 +410,8 @@ const AdminMonitor = () => {
<span>{segment.name}</span>
</div>
<span style={{ fontWeight: 600 }}>
${segment.cost.toFixed(2)} ({segment.percentage}%)
${segment.cost.toFixed(2)} ({segment.percentage}
{I18N_TECHNICAL_TEXT.PERCENT_CLOSE}
</span>
</div>
))}
@@ -662,7 +664,9 @@ const AdminMonitor = () => {
style={{ display: 'flex', alignItems: 'center', gap: '8px' }}
>
<BarChart3 size={18} />
<span>{t('请求趋势')} (24h)</span>
<span>
{t('请求趋势')} {I18N_TECHNICAL_TEXT.LAST_24_HOURS_SUFFIX}
</span>
</div>
}
styles={{ body: { padding: '20px' } }}
@@ -697,7 +701,10 @@ const AdminMonitor = () => {
style={{ display: 'flex', alignItems: 'center', gap: '8px' }}
>
<Activity size={18} />
<span>{t('Token消耗趋势')} (24h)</span>
<span>
{t('Token消耗趋势')}{' '}
{I18N_TECHNICAL_TEXT.LAST_24_HOURS_SUFFIX}
</span>
</div>
}
styles={{ body: { padding: '20px' } }}
@@ -732,7 +739,9 @@ const AdminMonitor = () => {
style={{ display: 'flex', alignItems: 'center', gap: '8px' }}
>
<AlertTriangle size={18} />
<span>{t('错误类型分布')} (24h)</span>
<span>
{t('错误类型分布')} {I18N_TECHNICAL_TEXT.LAST_24_HOURS_SUFFIX}
</span>
</div>
}
styles={{ body: { padding: '20px' } }}
+4 -2
View File
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import React, { useState, useEffect } from 'react';
import { Card, Row, Col, Badge, Empty, Spin } from '@/components/ui';
import { Activity, Zap } from 'lucide-react';
@@ -402,7 +403,8 @@ const ChannelMonitor = () => {
color: 'var(--ui-color-text-2)',
}}
>
{Math.round(channel.speedMs)}ms
{Math.round(channel.speedMs)}
{I18N_TECHNICAL_TEXT.MILLISECONDS}
</span>
</div>
<div className='speed-bar-container'>
@@ -439,7 +441,7 @@ const ChannelMonitor = () => {
size={14}
style={{ marginRight: '4px', verticalAlign: 'middle' }}
/>
{t('稳定性')} (24h)
{t('稳定性')} {I18N_TECHNICAL_TEXT.LAST_24_HOURS_SUFFIX}
</span>
<span
style={{
@@ -16,6 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../../i18n/technicalText.js';
import React from 'react';
import {
Card,
@@ -125,7 +127,7 @@ const ChannelMonitorView = ({ channelStatus, onRefresh }) => {
{channelStatus.map((group, groupIndex) => (
<div key={groupIndex} style={{ marginBottom: 32 }}>
<Title heading={4} style={{ marginBottom: 16, color: '#1890ff' }}>
📁 {group.categoryName}
{I18N_TECHNICAL_TEXT.FOLDER_ICON} {group.categoryName}
</Title>
<Row gutter={[16, 16]}>
+5 -3
View File
@@ -16,6 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import {
RefreshCw as ActionRefreshCw,
Plus as ActionPlus,
@@ -565,7 +567,7 @@ const OrgConnectors = ({ orgId }) => {
<TextArea
value={form.allowed_hosts}
onChange={(value) => setForm({ ...form, allowed_hosts: value })}
placeholder='api.example.com'
placeholder={I18N_TECHNICAL_TEXT.API_EXAMPLE_COM}
/>
</label>
<label>
@@ -584,7 +586,7 @@ const OrgConnectors = ({ orgId }) => {
<TextArea
value={form.allowed_cidrs}
onChange={(value) => setForm({ ...form, allowed_cidrs: value })}
placeholder={'10.20.0.0/16\nfd00:1::/48'}
placeholder={I18N_TECHNICAL_TEXT.CONNECTOR_CIDR_EXAMPLE}
/>
<span className='org-connector-note'>
{t(
@@ -598,7 +600,7 @@ const OrgConnectors = ({ orgId }) => {
autosize
value={form.config}
onChange={(value) => setForm({ ...form, config: value })}
placeholder='{"project_ids":["123"],"path_prefixes":["src/"]}'
placeholder={I18N_TECHNICAL_TEXT.CONNECTOR_SCOPE_EXAMPLE}
/>
</label>
</div>
+8 -2
View File
@@ -16,6 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import {
Search as ActionSearch,
RefreshCw as ActionRefreshCw,
@@ -227,9 +229,13 @@ const MemberUsageSheet = ({ visible, onClose, member, orgId, t }) => {
width: 120,
render: (_, record) => (
<div className='text-xs text-gray-600 dark:text-gray-400'>
<span title='Prompt'>{record.prompt_tokens || 0}</span>
<span title={I18N_TECHNICAL_TEXT.PROMPT}>
{record.prompt_tokens || 0}
</span>
<span className='mx-1 text-gray-300 dark:text-gray-600'>/</span>
<span title='Completion'>{record.completion_tokens || 0}</span>
<span title={I18N_TECHNICAL_TEXT.COMPLETION}>
{record.completion_tokens || 0}
</span>
</div>
),
},
+8 -3
View File
@@ -16,6 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import { RefreshCw as ActionRefreshCw } from '@/components/common/icons/ActionIcons';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import {
@@ -461,7 +463,9 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
{(data.alerts || []).map((row) => (
<article key={row.id}>
<div>
<strong>Skill #{row.dimension_id}</strong>
<strong>
{t('技能 #{{id}}', { id: row.dimension_id })}
</strong>
<Tag color={row.status === 'open' ? 'red' : 'green'}>
{row.status}
</Tag>
@@ -610,9 +614,10 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
<strong>{row.name}</strong>
<Tag>{row.status}</Tag>
</div>
<span>Skill #{row.skill_id}</span>
<span>{t('技能 #{{id}}', { id: row.skill_id })}</span>
<span>
A / B: {row.version_a_id} / {row.version_b_id}
{I18N_TECHNICAL_TEXT.AB_METRICS_PREFIX} {row.version_a_id} /{' '}
{row.version_b_id}
</span>
<span>
{t('目标样本')}: {row.target_sample}
+3 -1
View File
@@ -16,6 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import {
RefreshCw as ActionRefreshCw,
Plus as ActionPlus,
@@ -1349,7 +1351,7 @@ const OrgKnowledge = ({ orgId, canAuditContent = false }) => {
<div className='knowledge-eyebrow'>
<ShieldCheck size={15} />
<span>{t('企业可信知识层')}</span>
<span className='knowledge-beta'>BETA</span>
<span className='knowledge-beta'>{I18N_TECHNICAL_TEXT.BETA}</span>
</div>
<h1>{t('企业知识')}</h1>
<p>
+6 -2
View File
@@ -16,6 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import {
Search as ActionSearch,
Download as ActionDownload,
@@ -638,8 +640,10 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
width: 165,
render: (_, record) => (
<span className='oc-number'>
<span title='Prompt'>{record.prompt_tokens || 0}</span>{' '}
<span className='oc-muted' title='Completion'>
<span title={I18N_TECHNICAL_TEXT.PROMPT}>
{record.prompt_tokens || 0}
</span>{' '}
<span className='oc-muted' title={I18N_TECHNICAL_TEXT.COMPLETION}>
/ {record.completion_tokens || 0}
</span>
</span>
+12 -15
View File
@@ -812,10 +812,9 @@ const OrgMembers = ({
{/* 成员配额设置 Modal */}
<OrgModal
title={
t('设置成员配额上限') +
(quotaMemberName ? ` - ${quotaMemberName}` : '')
}
title={t('设置成员配额上限{{value}}', {
value: quotaMemberName ? ` - ${quotaMemberName}` : '',
})}
visible={quotaModalVisible}
onOk={handleQuotaLimitSave}
onCancel={() => setQuotaModalVisible(false)}
@@ -875,10 +874,9 @@ const OrgMembers = ({
{/* 成员模型限制 Modal */}
<OrgModal
title={
t('设置成员模型限制') +
(modelLimitsMemberName ? ` - ${modelLimitsMemberName}` : '')
}
title={t('设置成员模型限制{{value}}', {
value: modelLimitsMemberName ? ` - ${modelLimitsMemberName}` : '',
})}
visible={modelLimitsModalVisible}
onOk={handleModelLimitsSave}
onCancel={() => setModelLimitsModalVisible(false)}
@@ -923,10 +921,9 @@ const OrgMembers = ({
{/* 成员可调用分组 Modal */}
<OrgModal
title={
t('设置成员可调用分组') +
(groupsMemberName ? ` - ${groupsMemberName}` : '')
}
title={t('设置成员可调用分组{{value}}', {
value: groupsMemberName ? ` - ${groupsMemberName}` : '',
})}
visible={groupsModalVisible}
onOk={handleGroupsSave}
onCancel={() => setGroupsModalVisible(false)}
@@ -966,9 +963,9 @@ const OrgMembers = ({
{/* 管理员细粒度权限 Modal(owner 对 admin 下放) */}
<OrgModal
title={
t('设置管理员权限') + (permMemberName ? ` - ${permMemberName}` : '')
}
title={t('设置管理员权限{{value}}', {
value: permMemberName ? ` - ${permMemberName}` : '',
})}
visible={permModalVisible}
onOk={handlePermissionsSave}
onCancel={() => setPermModalVisible(false)}
+11 -5
View File
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import React, { useEffect, useMemo, useState } from 'react';
import { Button, Card, Empty, Tag, Typography } from 'antd';
import { Cable, LockKeyhole } from 'lucide-react';
@@ -183,11 +184,16 @@ const OrgMyConnectors = ({ orgId }) => {
<div className='org-capability-confirmation'>
<LockKeyhole size={14} aria-hidden='true' />
<Typography.Text type='secondary'>
{t('确认策略')}:{' '}
{t(
confirmationLabels[item.grant.confirmation_policy] ||
item.grant.confirmation_policy,
)}
<Trans
t={t}
i18nKey='确认策略: {{label}}'
values={{
label: t(
confirmationLabels[item.grant.confirmation_policy] ||
item.grant.confirmation_policy,
),
}}
/>
</Typography.Text>
</div>
<div className='org-capability-card-footer'>
+11 -2
View File
@@ -16,6 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
import React, { useCallback, useContext, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -353,8 +355,15 @@ const OrgPersonalSettings = ({ orgId }) => {
/>
<div className='oc-ps-quota-meta'>
<span>
{t('已用')} {renderQuota(usedQuota)} / {t('总额')}{' '}
{renderQuota(quotaLimit)}({usedPct}%)
<Trans
t={t}
i18nKey='已用 {{value}} / 总额 {{value2}}({{usedPct}}%)'
values={{
value: renderQuota(usedQuota),
value2: renderQuota(quotaLimit),
usedPct: usedPct,
}}
/>
</span>
{isPeriodic && (
<span>{quotaPeriodHint(t, myQuota.quota_period)}</span>
+3 -1
View File
@@ -16,6 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import {
FileCheck2 as ActionFileCheck2,
RotateCcw as ActionRotateCcw,
@@ -542,7 +544,7 @@ const OrgPrivateSkills = ({ orgId }) => {
))}
<TextArea
rows={10}
placeholder='Skill Markdown'
placeholder={I18N_TECHNICAL_TEXT.SKILL_MARKDOWN}
value={form.body}
onChange={(body) => setForm({ ...form, body })}
/>
+5 -1
View File
@@ -16,6 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import { Check as ActionCheck } from '@/components/common/icons/ActionIcons';
import React, { useEffect, useState, useCallback, useMemo } from 'react';
import { timestamp2string } from '../../helpers/utils';
@@ -786,7 +788,9 @@ const OrgRecharge = ({ orgId }) => {
maximumFractionDigits: 2,
})}
</b>
{payWay === 'paypal' && <span> USD</span>}
{payWay === 'paypal' && (
<span> {I18N_TECHNICAL_TEXT.USD}</span>
)}
</>
) : (
'-'
+1 -1
View File
@@ -203,7 +203,7 @@ const OrgResolver = ({
className='text-gray-400 flex-shrink-0'
/>
<span className='text-sm font-medium text-gray-900 dark:text-white truncate'>
{org.name || t('企业') + ' #' + org.id}
{org.name || t('企业 #{{id}}', { id: org.id })}
</span>
</div>
<span className='text-xs font-medium text-amber-600 dark:text-amber-400 flex-shrink-0'>
+5 -1
View File
@@ -16,6 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import {
ChevronDown as ActionChevronDown,
ChevronRight as ActionChevronRight,
@@ -573,7 +575,9 @@ const OrgSidebar = ({
{item.text}
</span>
{item.beta && (
<span className='ui-org-beta'>BETA</span>
<span className='ui-org-beta'>
{I18N_TECHNICAL_TEXT.BETA}
</span>
)}
</>
)}
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import {
ChevronRight as ActionChevronRight,
ChevronDown as ActionChevronDown,
@@ -212,7 +213,11 @@ const DeptNode = memo(({ data, selected }) => {
</div>
<div className='mt-1.5 flex items-center gap-2 flex-wrap'>
<Text type='tertiary' size='small'>
{t('子部门')} {childCount} · {t('排序')} {dept.sort || 0}
<Trans
t={t}
i18nKey='子部门 {{childCount}} · 排序 {{value}}'
values={{ childCount: childCount, value: dept.sort || 0 }}
/>
</Text>
<Tooltip content={t('查看直属成员')}>
<button
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import React, {
useCallback,
useEffect,
@@ -420,7 +421,11 @@ const OrgDsPolicy = ({ orgId, isSuperAdmin, refreshVersion = 0 }) => {
disabled={fieldsLocked}
/>
<p className='text-xs text-gray-400 dark:text-gray-500 mt-1'>
{t(field.hint)} {t('企业策略只能保持或收紧平台安全基线。')}
<Trans
t={t}
i18nKey='{{label}} 企业策略只能保持或收紧平台安全基线。'
values={{ label: t(field.hint) }}
/>
</p>
</div>
))}
@@ -365,7 +365,7 @@ const OrgDsRules = ({ orgId, isSuperAdmin }) => {
<Input
value={draft.pattern}
onChange={(v) => setDraft({ ...draft, pattern: v })}
placeholder={t('例如') + ' EMP[0-9]{6}'}
placeholder={t('例如 EMP[0-9]{6}')}
/>
</div>
<div>
+12 -5
View File
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import {
Copy as ActionCopy,
ReceiptText as ActionReceiptText,
@@ -1050,11 +1051,17 @@ function Bills({ t, readOnly }) {
/>
<div style={{ marginTop: 8 }}>
<Text type='tertiary' size='small'>
{t('争议对象')}:{' '}
{disputeTarget?.layer === 1
? disputeTarget?.customer_name
: disputeTarget?.source_partner_name}{' '}
· {t('返佣(元)')} {fmtYuan(disputeTarget?.rebate_yuan)}
<Trans
t={t}
i18nKey='争议对象: {{value}} · 返佣(元) {{value2}}'
values={{
value:
disputeTarget?.layer === 1
? disputeTarget?.customer_name
: disputeTarget?.source_partner_name,
value2: fmtYuan(disputeTarget?.rebate_yuan),
}}
/>
</Text>
</div>
<Form key={disputeTarget?.id || 0} onSubmit={dispute}>
+10 -2
View File
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import {
Check as ActionCheck,
ArrowUpRight as ActionArrowUpRight,
@@ -413,8 +414,15 @@ const MembershipPanel = () => {
<div className='rc-plan-empty'>
<Clock size={18} />
<strong>
{t(planTypeConfig[currentPeriod]?.label || currentPeriod)}
{t('套餐')}
<Trans
t={t}
i18nKey='{{label}}套餐'
values={{
label: t(
planTypeConfig[currentPeriod]?.label || currentPeriod,
),
}}
/>
</strong>
<span>{t('价格与权益待补充')}</span>
</div>
+3 -3
View File
@@ -233,9 +233,9 @@ const RechargePanel = ({
return (
<Tooltip
key={method.type}
content={
t('此支付方式最低充值金额为') + ' ' + minTopupVal
}
content={t('此支付方式最低充值金额为 {{minTopupVal}}', {
minTopupVal: minTopupVal,
})}
>
{button}
</Tooltip>
+2 -2
View File
@@ -148,7 +148,7 @@ const Recharge = ({ embedded = false }) => {
showSuccess(t('兑换成功!'));
Modal.success({
title: t('兑换成功!'),
content: t('成功兑换额度:') + renderQuota(data),
content: t('成功兑换额度:{{value}}', { value: renderQuota(data) }),
centered: true,
});
if (userState.user) {
@@ -695,7 +695,7 @@ const Recharge = ({ embedded = false }) => {
if (payWay === 'paypal') {
return payPalQuote ? formatPayPalUSD(payPalQuote.payAmount) : '-';
}
return amount + ' ' + t('元');
return t('{{value}}元', { value: amount + ' ' });
};
const handleCancel = () => {
+16 -5
View File
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import {
Zap as ActionZap,
ChevronRight as ActionChevronRight,
@@ -95,7 +96,8 @@ const StatusBars = ({ dataPoints = [], loading = false, t }) => {
<div className='text-xs p-1'>
<div style={{ color: bgColor }} className='font-semibold'>
{isHealthy ? t('正常') : t('异常')} (
{point.uptime_percent?.toFixed(1)}%)
{point.uptime_percent?.toFixed(1)}
{I18N_TECHNICAL_TEXT.PERCENT_CLOSE}
</div>
<div className='text-gray-400 mt-1'>
{point.timestamp
@@ -117,7 +119,7 @@ const StatusBars = ({ dataPoints = [], loading = false, t }) => {
})}
</div>
<div className='flex justify-between w-full text-[10px] text-gray-400 dark:text-gray-500 mt-1.5 font-medium'>
<span>1h</span>
<span>{I18N_TECHNICAL_TEXT.ONE_HOUR}</span>
<span>{t('现在')}</span>
</div>
</div>
@@ -188,7 +190,10 @@ const TestModelCell = ({ modelName, groupName, t }) => {
style={{ background: token.colorPrimaryBg }}
>
<span>✓</span>
<span>{result.time}ms</span>
<span>
{result.time}
{I18N_TECHNICAL_TEXT.MILLISECONDS}
</span>
</span>
) : (
<Tooltip title={result.error}>
@@ -197,7 +202,12 @@ const TestModelCell = ({ modelName, groupName, t }) => {
style={{ background: token.colorErrorBg }}
>
<span>✗</span>
{result.time > 0 && <span>{result.time}ms</span>}
{result.time > 0 && (
<span>
{result.time}
{I18N_TECHNICAL_TEXT.MILLISECONDS}
</span>
)}
</span>
</Tooltip>
)}
@@ -386,7 +396,8 @@ const GroupMonitor = () => {
<span
className={`font-medium ${value > 2000 ? 'text-orange-500' : 'text-gray-600 dark:text-gray-300'}`}
>
{value}ms
{value}
{I18N_TECHNICAL_TEXT.MILLISECONDS}
</span>
</div>
) : (
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import { RefreshCw as ActionRefreshCw } from '@/components/common/icons/ActionIcons';
import React, { useState, useEffect, useCallback } from 'react';
import {
@@ -329,7 +330,8 @@ const GroupMonitorAdmin = () => {
}}
>
<Zap className='w-3 h-3 inline mr-1' />
{time}ms
{time}
{I18N_TECHNICAL_TEXT.MILLISECONDS}
</span>
);
},
@@ -666,7 +668,9 @@ const GroupMonitorAdmin = () => {
<div className='text-center'>
<div className='text-2xl font-bold text-blue-500'>
{group.avg_response_time || '-'}
<span className='text-sm font-normal'>ms</span>
<span className='text-sm font-normal'>
{I18N_TECHNICAL_TEXT.MILLISECONDS}
</span>
</div>
<div className='text-xs text-gray-500'>
{t('平均响应')}
@@ -734,7 +738,8 @@ const GroupMonitorAdmin = () => {
</div>
<div className='stat-box'>
<div className='stat-box-value text-blue-500'>
{group.avg_response_time || '-'}ms
{group.avg_response_time || '-'}
{I18N_TECHNICAL_TEXT.MILLISECONDS}
</div>
<div className='stat-box-label'>
{t('平均响应')}
@@ -742,7 +747,8 @@ const GroupMonitorAdmin = () => {
</div>
<div className='stat-box'>
<div className='stat-box-value text-red-500'>
{group.max_response_time || '-'}ms
{group.max_response_time || '-'}
{I18N_TECHNICAL_TEXT.MILLISECONDS}
</div>
<div className='stat-box-label'>
{t('最慢响应')}
@@ -750,7 +756,8 @@ const GroupMonitorAdmin = () => {
</div>
<div className='stat-box'>
<div className='stat-box-value text-green-500'>
{group.min_response_time || '-'}ms
{group.min_response_time || '-'}
{I18N_TECHNICAL_TEXT.MILLISECONDS}
</div>
<div className='stat-box-label'>
{t('最快响应')}
@@ -791,7 +798,7 @@ const GroupMonitorAdmin = () => {
handleDateRangeChange(group.name, [start, now]);
}}
>
24h
{I18N_TECHNICAL_TEXT.LAST_24_HOURS}
</Button>
<Button
size='small'
@@ -803,7 +810,7 @@ const GroupMonitorAdmin = () => {
handleDateRangeChange(group.name, [start, now]);
}}
>
7d
{I18N_TECHNICAL_TEXT.LAST_7_DAYS}
</Button>
<Button
size='small'
@@ -815,7 +822,7 @@ const GroupMonitorAdmin = () => {
handleDateRangeChange(group.name, [start, now]);
}}
>
30d
{I18N_TECHNICAL_TEXT.LAST_30_DAYS}
</Button>
</Space>
</div>
@@ -187,7 +187,7 @@ const SettingsAPIInfo = ({ options, refresh }) => {
: t('API信息已添加,请及时点击“保存设置”进行保存'),
);
} catch (error) {
showError(t('操作失败') + ': ' + error.message);
showError(t('操作失败: {{message}}', { message: error.message }));
} finally {
setModalLoading(false);
}
@@ -309,7 +309,7 @@ const SettingsAnnouncements = ({ options, refresh }) => {
: t('公告已添加,请及时点击“保存设置”进行保存'),
);
} catch (error) {
showError(t('操作失败') + ': ' + error.message);
showError(t('操作失败: {{message}}', { message: error.message }));
} finally {
setModalLoading(false);
}
+1 -1
View File
@@ -229,7 +229,7 @@ const SettingsFAQ = ({ options, refresh }) => {
: t('问答已添加,请及时点击“保存设置”进行保存'),
);
} catch (error) {
showError(t('操作失败') + ': ' + error.message);
showError(t('操作失败: {{message}}', { message: error.message }));
} finally {
setModalLoading(false);
}
@@ -251,7 +251,7 @@ const SettingsUptimeKuma = ({ options, refresh }) => {
: t('分类已添加,请及时点击“保存设置”进行保存'),
);
} catch (error) {
showError(t('操作失败') + ': ' + error.message);
showError(t('操作失败: {{message}}', { message: error.message }));
} finally {
setModalLoading(false);
}
+10 -3
View File
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
import React, { useEffect, useState, useRef } from 'react';
import { Button, Col, Form, Row, Spin, Tag } from '@/components/ui';
@@ -167,9 +168,15 @@ export default function SettingsDrawing(props) {
field={'MjModeClearEnabled'}
label={
<>
{t('开启之后会清除用户提示词中的')} <Tag>--fast</Tag> 、
<Tag>--relax</Tag> {t('以及')} <Tag>--turbo</Tag>{' '}
{t('参数')}
<Trans
t={t}
i18nKey='开启之后会清除用户提示词中的 <part0>--fast</part0> 、<part1>--relax</part1> 以及 <part2>--turbo</part2> 参数'
components={{
part0: <Tag />,
part1: <Tag />,
part2: <Tag />,
}}
/>
</>
}
size='default'
+12 -18
View File
@@ -128,14 +128,12 @@ export default function SettingClaudeModel(props) {
<Form.TextArea
label={t('Claude请求头覆盖')}
field={'claude.model_headers_settings'}
placeholder={
t('为一个 JSON 文本,例如:') +
'\n' +
JSON.stringify(CLAUDE_HEADER, null, 2)
}
extraText={
t('示例') + '\n' + JSON.stringify(CLAUDE_HEADER, null, 2)
}
placeholder={t('为一个 JSON 文本,例如:\n{{value}}', {
value: JSON.stringify(CLAUDE_HEADER, null, 2),
})}
extraText={t('示例\n{{value}}', {
value: JSON.stringify(CLAUDE_HEADER, null, 2),
})}
autosize={{ minRows: 6, maxRows: 12 }}
trigger='blur'
stopValidateWithError
@@ -159,16 +157,12 @@ export default function SettingClaudeModel(props) {
<Form.TextArea
label={t('缺省 MaxTokens')}
field={'claude.default_max_tokens'}
placeholder={
t('为一个 JSON 文本,例如:') +
'\n' +
JSON.stringify(CLAUDE_DEFAULT_MAX_TOKENS, null, 2)
}
extraText={
t('示例') +
'\n' +
JSON.stringify(CLAUDE_DEFAULT_MAX_TOKENS, null, 2)
}
placeholder={t('为一个 JSON 文本,例如:\n{{value}}', {
value: JSON.stringify(CLAUDE_DEFAULT_MAX_TOKENS, null, 2),
})}
extraText={t('示例\n{{value}}', {
value: JSON.stringify(CLAUDE_DEFAULT_MAX_TOKENS, null, 2),
})}
autosize={{ minRows: 6, maxRows: 12 }}
trigger='blur'
stopValidateWithError
+10 -16
View File
@@ -119,11 +119,9 @@ export default function SettingGeminiModel(props) {
<Col xs={24} sm={12} md={8} lg={8} xl={8}>
<Form.TextArea
label={t('Gemini安全设置')}
placeholder={
t('为一个 JSON 文本,例如:') +
'\n' +
JSON.stringify(GEMINI_SETTING_EXAMPLE, null, 2)
}
placeholder={t('为一个 JSON 文本,例如:\n{{value}}', {
value: JSON.stringify(GEMINI_SETTING_EXAMPLE, null, 2),
})}
field={'gemini.safety_settings'}
extraText={t(
'default为默认设置,可单独设置每个分类的安全等级',
@@ -147,11 +145,9 @@ export default function SettingGeminiModel(props) {
<Col xs={24} sm={12} md={8} lg={8} xl={8}>
<Form.TextArea
label={t('Gemini版本设置')}
placeholder={
t('为一个 JSON 文本,例如:') +
'\n' +
JSON.stringify(GEMINI_VERSION_EXAMPLE, null, 2)
}
placeholder={t('为一个 JSON 文本,例如:\n{{value}}', {
value: JSON.stringify(GEMINI_VERSION_EXAMPLE, null, 2),
})}
field={'gemini.version_settings'}
extraText={t('default为默认设置,可单独设置每个模型的版本')}
autosize={{ minRows: 6, maxRows: 12 }}
@@ -191,15 +187,13 @@ export default function SettingGeminiModel(props) {
<Form.TextArea
field={'gemini.supported_imagine_models'}
label={t('支持的图像模型')}
placeholder={
t('例如:') +
'\n' +
JSON.stringify(
placeholder={t('例如:\n{{value}}', {
value: JSON.stringify(
['gemini-2.0-flash-exp-image-generation'],
null,
2,
)
}
),
})}
onChange={(value) =>
setInputs({
...inputs,
@@ -189,7 +189,9 @@ export default function SettingGlobalModel(props) {
<Form.TextArea
label={t('禁用思考处理的模型列表')}
field={'global.thinking_model_blacklist'}
placeholder={t('例如:') + '\n' + thinkingExample}
placeholder={t('例如:\n{{thinkingExample}}', {
thinkingExample: thinkingExample,
})}
rows={4}
rules={[
{
@@ -255,7 +257,9 @@ export default function SettingGlobalModel(props) {
<Form.TextArea
label={t('强制 Responses 协议的模型列表')}
field={'general_setting.force_responses_models'}
placeholder={t('例如:') + '\n' + forceResponsesExample}
placeholder={t('例如:\n{{forceResponsesExample}}', {
forceResponsesExample: forceResponsesExample,
})}
rows={4}
extraText={t('多个模型用逗号或换行分隔。留空则该功能不生效')}
onChange={(value) =>
@@ -80,7 +80,7 @@ const SettingModelCategory = () => {
showError(message || t('加载分类失败'));
}
} catch (error) {
showError(t('加载分类失败: ') + error.message);
showError(t('加载分类失败: {{message}}', { message: error.message }));
} finally {
setLoading(false);
}
@@ -181,8 +181,10 @@ const SettingModelCategory = () => {
}
} catch (error) {
showError(
(editingCategory.id === 0 ? t('创建失败: ') : t('保存失败: ')) +
error.message,
t('{{value}}{{message}}', {
value: editingCategory.id === 0 ? t('创建失败: ') : t('保存失败: '),
message: error.message,
}),
);
}
};
@@ -199,7 +201,7 @@ const SettingModelCategory = () => {
showError(message || t('删除失败'));
}
} catch (error) {
showError(t('删除失败: ') + error.message);
showError(t('删除失败: {{message}}', { message: error.message }));
}
};
@@ -215,7 +217,7 @@ const SettingModelCategory = () => {
showError(message || t('重置失败'));
}
} catch (error) {
showError(t('重置失败: ') + error.message);
showError(t('重置失败: {{message}}', { message: error.message }));
}
};
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../../i18n/technicalText.js';
import React, { useEffect, useState, useRef } from 'react';
import {
Button,
@@ -836,7 +837,7 @@ export default function SettingVideoModel(props) {
fontSize: 12,
}}
>
{'"metadata": { "mode": "pro", "resolution": "1080P" }'}
{I18N_TECHNICAL_TEXT.VIDEO_METADATA_EXAMPLE}
</pre>
<div style={{ marginTop: 4 }}>
{t('未传入选档值时,将按上面配置的「默认档位」计费。')}
@@ -17,6 +17,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import { I18N_TECHNICAL_TEXT } from '../../../i18n/technicalText.js';
import {
Save as ActionSave,
RefreshCw as ActionRefreshCw,
@@ -538,11 +540,16 @@ export default function SettingsExperienceCenter({ options, refresh }) {
outerBottomSlot={
selectedModels.length > 0 && (
<div className='px-3 py-2 border-t border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 text-xs text-gray-500 dark:text-gray-400'>
{t('已选择')}{' '}
<span className='font-semibold text-brand-deep dark:text-brand-from'>
{selectedModels.length}
</span>{' '}
{t('个模型')}
<Trans
t={t}
i18nKey='已选择 <part0>{{length}}</part0> 个模型'
values={{ length: selectedModels.length }}
components={{
part0: (
<span className='font-semibold text-brand-deep dark:text-brand-from' />
),
}}
/>
</div>
)
}
@@ -584,11 +591,16 @@ export default function SettingsExperienceCenter({ options, refresh }) {
outerBottomSlot={
selectedVisionModels.length > 0 && (
<div className='px-3 py-2 border-t border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 text-xs text-gray-500 dark:text-gray-400'>
{t('已选择')}{' '}
<span className='font-semibold text-brand-deep dark:text-brand-from'>
{selectedVisionModels.length}
</span>{' '}
{t('个模型')}
<Trans
t={t}
i18nKey='已选择 <part0>{{length}}</part0> 个模型'
values={{ length: selectedVisionModels.length }}
components={{
part0: (
<span className='font-semibold text-brand-deep dark:text-brand-from' />
),
}}
/>
</div>
)
}
@@ -713,11 +725,16 @@ export default function SettingsExperienceCenter({ options, refresh }) {
/>
{selectedAllowedGroups.length > 0 && (
<Text type='tertiary' size='small' className='block mt-1.5'>
{t('已选择')}{' '}
<span className='font-semibold text-brand-deep dark:text-brand-from'>
{selectedAllowedGroups.length}
</span>{' '}
{t('个分组')}
<Trans
t={t}
i18nKey='已选择 <part0>{{length}}</part0> 个分组'
values={{ length: selectedAllowedGroups.length }}
components={{
part0: (
<span className='font-semibold text-brand-deep dark:text-brand-from' />
),
}}
/>
</Text>
)}
</div>
@@ -796,7 +813,7 @@ export default function SettingsExperienceCenter({ options, refresh }) {
rel='noreferrer'
className='text-brand-deep dark:text-brand-from hover:underline ml-1'
>
api-dashboard.search.brave.com
{I18N_TECHNICAL_TEXT.API_DASHBOARD_SEARCH_BRAVE_COM}
</a>
</Text>
</div>
@@ -827,7 +844,7 @@ export default function SettingsExperienceCenter({ options, refresh }) {
rel='noreferrer'
className='text-brand-deep dark:text-brand-from hover:underline ml-1'
>
open.bochaai.com
{I18N_TECHNICAL_TEXT.OPEN_BOCHAAI_COM}
</a>
</Text>
</div>
@@ -88,7 +88,9 @@ export default function SettingsFallback(props) {
showSuccess(t('保存成功'));
} else {
showError(
t('保存失败: ') + Array.from(new Set(failedMessages)).join(';'),
t('保存失败: {{value}}', {
value: Array.from(new Set(failedMessages)).join(';'),
}),
);
}
})
@@ -184,7 +184,11 @@ export default function GeneralSettings(props) {
showError(res.data.message || t('COS连接测试失败'));
}
} catch (error) {
showError(t('COS连接测试失败') + ': ' + (error.message || t('未知错误')));
showError(
t('COS连接测试失败: {{value}}', {
value: error.message || t('未知错误'),
}),
);
} finally {
setTestingCos(false);
}
@@ -20,6 +20,8 @@ For commercial licensing, please contact support@quantumnous.com
// 运营设置 → 语言与地区:按访客 IP 国家自动选择界面语言的配置卡片。
// 整份配置存于单个 option key "LanguageSetting"(JSON),后端入库前整份校验;
// 这里的前端校验只为即时提示,口径与 setting/language_setting.Validate 一致。
import { I18N_TECHNICAL_TEXT } from '../../../i18n/technicalText.js';
import {
ArrowUp as ActionArrowUp,
ArrowDown as ActionArrowDown,
@@ -757,7 +759,7 @@ export default function SettingsLanguage(props) {
target='_blank'
rel='noopener noreferrer'
>
DB-IP.com
{I18N_TECHNICAL_TEXT.DB_IP_COM}
</a>
</Text>
</Form.Section>
+3 -1
View File
@@ -168,7 +168,9 @@ export default function SettingsLog(props) {
showSuccess(t('{{n}} 条日志已清理!', { n: data, count: data }));
return;
} else {
throw new Error(t('日志清理失败:') + message);
throw new Error(
t('日志清理失败:{{message}}', { message: message }),
);
}
} catch (error) {
showError(error.message);
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import React, { useState } from 'react';
import { Form, Button, Typography, Space, Divider } from '@/components/ui';
import { API, showError, showSuccess } from '../../../helpers';
@@ -99,15 +100,19 @@ const SettingsPaymentAlipay = ({ options, refresh }) => {
<>
<Title heading={5}>{t('支付宝配置')}</Title>
<Text type='tertiary'>
{t('配置支付宝电脑网站支付、手机网站支付和当面付扫码支付。请前往')}{' '}
<a
href='https://open.alipay.com'
target='_blank'
rel='noopener noreferrer'
>
{t('支付宝开放平台')}
</a>{' '}
{t('获取相关配置信息。')}
<Trans
t={t}
i18nKey='配置支付宝电脑网站支付、手机网站支付和当面付扫码支付。请前往 <part0>支付宝开放平台</part0> 获取相关配置信息。'
components={{
part0: (
<a
href='https://open.alipay.com'
target='_blank'
rel='noopener noreferrer'
/>
),
}}
/>
</Text>
<Divider margin='12px' />
@@ -264,7 +264,7 @@ export default function SettingsPaymentGatewayCreem(props) {
<Text>
{t('Creem 介绍')}
<a href='https://creem.io' target='_blank' rel='noreferrer'>
Creem Official Site
{t('Creem 官网')}
</a>
<br />
</Text>
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import React, {
useCallback,
useEffect,
@@ -373,7 +374,7 @@ export default function SettingsPaymentGatewayPayPal(props) {
showSuccess(
t(
operation === 'inspect'
? t('批量查询完成:成功 {{succeeded}} 笔,失败 {{failed}} 笔')
? '批量查询完成:成功 {{succeeded}} 笔,失败 {{failed}} 笔'
: '批量对账完成:成功 {{succeeded}} 笔,失败 {{failed}} 笔',
{ succeeded: data.succeeded || 0, failed: data.failed || 0 },
),
@@ -442,7 +443,7 @@ export default function SettingsPaymentGatewayPayPal(props) {
showSuccess(
t(
batchExpire.force
? t('批量强制过期完成:成功 {{succeeded}} 笔,失败 {{failed}} 笔')
? '批量强制过期完成:成功 {{succeeded}} 笔,失败 {{failed}} 笔'
: '批量过期完成:成功 {{succeeded}} 笔,失败 {{failed}} 笔',
{ succeeded: data.succeeded || 0, failed: data.failed || 0 },
),
@@ -708,14 +709,20 @@ export default function SettingsPaymentGatewayPayPal(props) {
</Col>
<Col xs={24} md={8}>
<Text type='tertiary'>
{t('手续费策略版本')}:{feePolicy?.version || '-'}
<br />
{t('最后更新')}:
{feePolicy?.updated_at
? new Date(feePolicy.updated_at * 1000).toLocaleString()
: '-'}
<br />
{t('最后更新人')}:{feePolicy?.updated_by || '-'}
<Trans
t={t}
i18nKey='手续费策略版本:{{value}}<part0/>最后更新:{{value2}}<part1/>最后更新人:{{value3}}'
values={{
value: feePolicy?.version || '-',
value2: feePolicy?.updated_at
? new Date(
feePolicy.updated_at * 1000,
).toLocaleString()
: '-',
value3: feePolicy?.updated_by || '-',
}}
components={{ part0: <br />, part1: <br /> }}
/>
</Text>
</Col>
</Row>
@@ -752,9 +759,7 @@ export default function SettingsPaymentGatewayPayPal(props) {
operations
? t(
operations.can_change_config
? t(
'配置切换预检:{{n}} 笔 PayPal pending 订单;可以切换环境或应用配置',
)
? '配置切换预检:{{n}} 笔 PayPal pending 订单;可以切换环境或应用配置'
: '配置切换预检:{{n}} 笔 PayPal pending 订单;请先隐藏新订单并完成历史订单排空',
{ n: operations.pending_count || 0 },
)
@@ -893,10 +898,12 @@ export default function SettingsPaymentGatewayPayPal(props) {
</Col>
<Col xs={24} md={8}>
<Text type='tertiary'>
{t('结算币种')}:USD
<br />
{t('换算汇率')}:USDExchangeRate ={' '}
{props.options?.USDExchangeRate || '-'}
<Trans
t={t}
i18nKey='结算币种:USD<part0/>换算汇率:USDExchangeRate = {{value}}'
values={{ value: props.options?.USDExchangeRate || '-' }}
components={{ part0: <br /> }}
/>
</Text>
</Col>
</Row>
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import React, { useEffect, useState, useRef } from 'react';
import {
Banner,
@@ -167,24 +168,27 @@ export default function SettingsPaymentGateway(props) {
>
<Form.Section text={t('Stripe 设置')}>
<Text>
{t('Stripe 密钥、Webhook 等设置请')}
<a
href='https://dashboard.stripe.com/developers'
target='_blank'
rel='noreferrer'
>
{t('点击此处')}
</a>
{t('进行设置,最好先在')}
<a
href='https://dashboard.stripe.com/test/developers'
target='_blank'
rel='noreferrer'
>
{t('测试环境')}
</a>
{t('进行测试。')}
<br />
<Trans
t={t}
i18nKey='Stripe 密钥、Webhook 等设置请<part0>点击此处</part0>进行设置,最好先在<part1>测试环境</part1>进行测试。<part2/>'
components={{
part0: (
<a
href='https://dashboard.stripe.com/developers'
target='_blank'
rel='noreferrer'
/>
),
part1: (
<a
href='https://dashboard.stripe.com/test/developers'
target='_blank'
rel='noreferrer'
/>
),
part2: <br />,
}}
/>
</Text>
<Banner
type='info'
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import React, { useState } from 'react';
import { Form, Button, Typography, Space, Divider } from '@/components/ui';
import { API, showError, showSuccess } from '../../../helpers';
@@ -125,15 +126,19 @@ const SettingsPaymentWechat = ({ options, refresh }) => {
<>
<Title heading={5}>{t('微信支付配置')}</Title>
<Text type='tertiary'>
{t('配置微信支付 Native(扫码)和 H5 支付方式。请前往')}{' '}
<a
href='https://pay.weixin.qq.com'
target='_blank'
rel='noopener noreferrer'
>
{t('微信支付商户平台')}
</a>{' '}
{t('获取相关配置信息。')}
<Trans
t={t}
i18nKey='配置微信支付 Native(扫码)和 H5 支付方式。请前往 <part0>微信支付商户平台</part0> 获取相关配置信息。'
components={{
part0: (
<a
href='https://pay.weixin.qq.com'
target='_blank'
rel='noopener noreferrer'
/>
),
}}
/>
</Text>
<Divider margin='12px' />
+23 -8
View File
@@ -16,6 +16,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import { I18N_TECHNICAL_TEXT } from '../../../i18n/technicalText.js';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import {
Banner,
@@ -662,8 +665,10 @@ export default function ModelCostSettings() {
ok = false;
const fails = d.failures || [];
showError(
(res.data?.message || t('部分保存失败')) +
(fails.length ? ': ' + fails.slice(0, 3).join('; ') : ''),
t('{{value}}{{value2}}', {
value: res.data?.message || t('部分保存失败'),
value2: fails.length ? ': ' + fails.slice(0, 3).join('; ') : '',
}),
);
}
}
@@ -855,8 +860,10 @@ export default function ModelCostSettings() {
} else {
const fails = res.data?.data?.failures || [];
showError(
(res.data?.message || t('保存失败')) +
(fails.length ? ': ' + fails.join('; ') : ''),
t('{{value}}{{value2}}', {
value: res.data?.message || t('保存失败'),
value2: fails.length ? ': ' + fails.join('; ') : '',
}),
);
}
} catch (e) {
@@ -1001,7 +1008,8 @@ export default function ModelCostSettings() {
)}
>
<div className='opacity-70'>
{r.label} ¥{r.price} / 1M({r.ratio}×)
{r.label} ¥{r.price} / 1M({r.ratio}
{I18N_TECHNICAL_TEXT.MULTIPLIER_CLOSE_CJK}
</div>
</Tooltip>
))}
@@ -1044,8 +1052,15 @@ export default function ModelCostSettings() {
prefix='¥'
suffix={
<span className='text-xs text-gray-400'>
{t(meta.suffix)} {t(meta.label)}
{tier ? ` · ${tier}` : ''}
<Trans
t={t}
i18nKey='{{label}} {{label2}}{{value}}'
values={{
label: t(meta.suffix),
label2: t(meta.label),
value: tier ? ` · ${tier}` : '',
}}
/>
</span>
}
value={slotValue(row, k)}
@@ -1780,7 +1795,7 @@ export default function ModelCostSettings() {
</div>
<div style={{ width: '100%' }}>
<Text type='secondary' size='small'>
{t('失效时间')}({t('留空表示长期有效')})
<Trans t={t} i18nKey='失效时间(留空表示长期有效)' />
</Text>
<DatePicker
type='dateTime'
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../../i18n/technicalText.js';
import React, {
useCallback,
useContext,
@@ -1276,7 +1277,7 @@ export default function ModelOfficialPriceSettings(props) {
value={importText}
onChange={(v) => setImportText(v)}
rows={6}
placeholder='{"gpt-4o": {"input": 8, "output": 24}}'
placeholder={I18N_TECHNICAL_TEXT.MODEL_PRICE_EXAMPLE}
/>
<div className='flex items-center justify-between mt-2'>
<RadioGroup
@@ -162,7 +162,7 @@ export default function UpstreamRatioSync(props) {
showError(res.data.message);
}
} catch (error) {
showError(t('获取渠道失败:') + error.message);
showError(t('获取渠道失败:{{message}}', { message: error.message }));
} finally {
setLoading(false);
}
@@ -211,8 +211,9 @@ export default function UpstreamRatioSync(props) {
const errorResults = test_results.filter((r) => r.status === 'error');
if (errorResults.length > 0) {
showWarning(
t('部分渠道测试失败:') +
errorResults.map((r) => `${r.name}: ${r.error}`).join(', '),
t('部分渠道测试失败:{{value}}', {
value: errorResults.map((r) => `${r.name}: ${r.error}`).join(', '),
}),
);
}
@@ -223,7 +224,7 @@ export default function UpstreamRatioSync(props) {
showSuccess(t('未找到差异化倍率,无需同步'));
}
} catch (e) {
showError(t('请求后端接口失败:') + e.message);
showError(t('请求后端接口失败:{{message}}', { message: e.message }));
} finally {
setSyncLoading(false);
}
@@ -601,7 +602,9 @@ export default function UpstreamRatioSync(props) {
return (
<Tooltip
content={t('以下上游数据可能不可信:') + untrustedSources}
content={t('以下上游数据可能不可信:{{untrustedSources}}', {
untrustedSources: untrustedSources,
})}
>
<Tag
color='yellow'
@@ -22,6 +22,7 @@ For commercial licensing, please contact support@quantumnous.com
// 这里增删改条目、上下架、排序,改完客户端下次刷新就能看到,不用发版。
// root 和被下放了「WeyAi」页签的管理员都能用。
import { Trans } from 'react-i18next';
import React, { useCallback, useEffect, useState } from 'react';
import {
Banner,
@@ -359,8 +360,11 @@ const SettingsWeyAiContent = () => {
</div>
{slot && (
<Text type='tertiary' size='small'>
{t(slot.description)} ·{' '}
{t('最多 {{count}} 条', { count: slot.max_items })}
<Trans
t={t}
i18nKey='{{label}} · 最多 {{count}} 条'
values={{ label: t(slot.description), count: slot.max_items }}
/>
</Text>
)}
</Card>
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../../i18n/technicalText.js';
import React from 'react';
import { Button, Drawer, Tag } from 'antd';
import { useTranslation } from 'react-i18next';
@@ -61,7 +62,9 @@ const SkillDetailDrawer = ({
<section>
<h3>{t('来源')}</h3>
<p>
{sourceText} · {skill.canonical_id} · v{skill.version_no}
{sourceText} · {skill.canonical_id}{' '}
{I18N_TECHNICAL_TEXT.VERSION_PREFIX}
{skill.version_no}
</p>
</section>
{children}
+6 -1
View File
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import {
Ban as ActionBan,
ShieldCheck as ActionShieldCheck,
@@ -908,7 +909,11 @@ const CreateMembershipModal = ({
{t('每日额度')}:{renderQuota(selectedPlan.daily_quota, 2)}
</div>
<div>
{t('原方案天数')}:{selectedPlan.duration_days} {t('天')}
<Trans
t={t}
i18nKey='原方案天数:{{duration_days}} 天'
values={{ duration_days: selectedPlan.duration_days }}
/>
</div>
</div>
)}
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { I18N_TECHNICAL_TEXT } from '../../../i18n/technicalText.js';
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
import React, { useState, useEffect, useRef } from 'react';
import { useTranslation } from 'react-i18next';
@@ -248,7 +249,9 @@ const VideoTutorial = () => {
<div className='video-tips'>
<Card className='video-tips-card'>
<div className='video-tips-content'>
<span className='video-tips-icon'>💡</span>
<span className='video-tips-icon'>
{I18N_TECHNICAL_TEXT.TIP_ICON}
</span>
<div>
<Text strong>{t('观看提示')}</Text>
<Paragraph
+68 -25
View File
@@ -17,6 +17,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import { writeClipboardText } from '../../helpers/clipboard';
import React, { useState, useContext, useRef } from 'react';
import { useTranslation } from 'react-i18next';
@@ -200,7 +202,9 @@ const Tutorial = () => {
<Card className='tutorial-card tutorial-warning-card'>
<div className='tutorial-warning-content'>
<div className='tutorial-warning-icon'>⚠️</div>
<div className='tutorial-warning-icon'>
{I18N_TECHNICAL_TEXT.WARNING_ICON}
</div>
<div>
<Text strong>{t('重要提示')}</Text>
<Paragraph
@@ -258,11 +262,18 @@ const Tutorial = () => {
<div className='tutorial-step-item'>
<span className='tutorial-step-number'>1</span>
<span>
{t('在')}
<Link to='/user-center/key-management' className='tutorial-link'>
「{t('密钥管理')}」
</Link>
{t('页面找到刚创建的密钥')}
<Trans
t={t}
i18nKey='在<part0>「密钥管理」</part0>页面找到刚创建的密钥'
components={{
part0: (
<Link
to='/user-center/key-management'
className='tutorial-link'
/>
),
}}
/>
</span>
</div>
<div className='tutorial-step-item'>
@@ -278,7 +289,9 @@ const Tutorial = () => {
<Card className='tutorial-card tutorial-tip-card'>
<div className='tutorial-tip-content'>
<div className='tutorial-tip-icon'>💡</div>
<div className='tutorial-tip-icon'>
{I18N_TECHNICAL_TEXT.TIP_ICON}
</div>
<div>
<Text strong>{t('小提示')}</Text>
<Paragraph
@@ -330,14 +343,18 @@ const Tutorial = () => {
<div className='tutorial-step-item'>
<span className='tutorial-step-number'>1</span>
<span>
{t('点击页面右上角的')}
<Link
to='/recharge'
className='tutorial-link tutorial-link-orange'
>
「{t('充值')}」
</Link>
{t('按钮')}
<Trans
t={t}
i18nKey='点击页面右上角的<part0>「充值」</part0>按钮'
components={{
part0: (
<Link
to='/recharge'
className='tutorial-link tutorial-link-orange'
/>
),
}}
/>
</span>
</div>
<div className='tutorial-step-item'>
@@ -353,7 +370,9 @@ const Tutorial = () => {
<Card className='tutorial-card tutorial-info-card'>
<div className='tutorial-info-content'>
<div className='tutorial-info-icon'>💰</div>
<div className='tutorial-info-icon'>
{I18N_TECHNICAL_TEXT.MONEY_ICON}
</div>
<div>
<Text strong>{t('计费说明')}</Text>
<Paragraph
@@ -432,7 +451,11 @@ const Tutorial = () => {
className='tutorial-os-tabs'
>
<TabPane
tab={<span className='tutorial-tab-label'>🪟 Windows</span>}
tab={
<span className='tutorial-tab-label'>
{I18N_TECHNICAL_TEXT.WINDOWS_PLATFORM}
</span>
}
itemKey='windows'
>
<div className='tutorial-tab-content'>
@@ -454,7 +477,11 @@ const Tutorial = () => {
</TabPane>
<TabPane
tab={<span className='tutorial-tab-label'>🍎 macOS</span>}
tab={
<span className='tutorial-tab-label'>
{I18N_TECHNICAL_TEXT.MACOS_PLATFORM}
</span>
}
itemKey='macos'
>
<div className='tutorial-tab-content'>
@@ -476,7 +503,11 @@ source ~/.zshrc`,
</TabPane>
<TabPane
tab={<span className='tutorial-tab-label'>🐧 Linux</span>}
tab={
<span className='tutorial-tab-label'>
{I18N_TECHNICAL_TEXT.LINUX_PLATFORM}
</span>
}
itemKey='linux'
>
<div className='tutorial-tab-content'>
@@ -548,7 +579,9 @@ source ~/.bashrc`,
</div>
<div className='tutorial-completion-card'>
<div className='tutorial-completion-icon'>🎉</div>
<div className='tutorial-completion-icon'>
{I18N_TECHNICAL_TEXT.CELEBRATION_ICON}
</div>
<Title heading={4}>{t('准备就绪!')}</Title>
<Paragraph>
{t('您已经完成了所有配置,现在可以开始使用 AI 服务了')}
@@ -582,7 +615,9 @@ source ~/.bashrc`,
to='/market'
className='tutorial-explore-card tutorial-explore-card-purple'
>
<div className='tutorial-explore-icon'>💎</div>
<div className='tutorial-explore-icon'>
{I18N_TECHNICAL_TEXT.DIAMOND_ICON}
</div>
<div className='tutorial-explore-content'>
<Text strong>{t('模型超市')}</Text>
<Paragraph type='secondary' style={{ marginBottom: 0 }}>
@@ -598,7 +633,9 @@ source ~/.bashrc`,
rel='noopener noreferrer'
className='tutorial-explore-card tutorial-explore-card-blue'
>
<div className='tutorial-explore-icon'>📚</div>
<div className='tutorial-explore-icon'>
{I18N_TECHNICAL_TEXT.BOOKS_ICON}
</div>
<div className='tutorial-explore-content'>
<Text strong>{t('使用文档')}</Text>
<Paragraph type='secondary' style={{ marginBottom: 0 }}>
@@ -612,7 +649,9 @@ source ~/.bashrc`,
to='/experience-center'
className='tutorial-explore-card tutorial-explore-card-green'
>
<div className='tutorial-explore-icon'>🎮</div>
<div className='tutorial-explore-icon'>
{I18N_TECHNICAL_TEXT.GAME_ICON}
</div>
<div className='tutorial-explore-content'>
<Text strong>{t('体验中心')}</Text>
<Paragraph type='secondary' style={{ marginBottom: 0 }}>
@@ -626,7 +665,9 @@ source ~/.bashrc`,
to='/user-center'
className='tutorial-explore-card tutorial-explore-card-orange'
>
<div className='tutorial-explore-icon'>📊</div>
<div className='tutorial-explore-icon'>
{I18N_TECHNICAL_TEXT.CHART_ICON}
</div>
<div className='tutorial-explore-content'>
<Text strong>{t('用户中心')}</Text>
<Paragraph type='secondary' style={{ marginBottom: 0 }}>
@@ -741,7 +782,9 @@ source ~/.bashrc`,
{/* 底部完成提示 */}
<div className='tutorial-scroll-end'>
<div className='tutorial-scroll-end-icon'>🎉</div>
<div className='tutorial-scroll-end-icon'>
{I18N_TECHNICAL_TEXT.CELEBRATION_ICON}
</div>
<Paragraph type='secondary'>
{t('恭喜!您已浏览完所有教程内容')}
</Paragraph>
+11 -2
View File
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import {
Zap as ActionZap,
UserPlus as ActionUserPlus,
@@ -531,7 +532,11 @@ const Invite = () => {
)}
{remainingDays > 0 && (
<span className='ml-2 text-amber-600 dark:text-amber-300'>
({t('\u5269\u4f59')} {remainingDays} {t('\u5929')})
<Trans
t={t}
i18nKey='(剩余 {{remainingDays}} 天)'
values={{ remainingDays: remainingDays }}
/>
</span>
)}
</p>
@@ -683,7 +688,11 @@ const Invite = () => {
</div>
<div>
<Typography.Text strong className='block mb-2'>
{t('划转额度')} ({t('最低')} {renderQuota(getQuotaPerUnit())})
<Trans
t={t}
i18nKey='划转额度 (最低 {{value}})'
values={{ value: renderQuota(getQuotaPerUnit()) }}
/>
</Typography.Text>
<QuotaInput
minQuota={getQuotaPerUnit()}
+16 -3
View File
@@ -16,6 +16,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Trans } from 'react-i18next';
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import {
Eye as ActionEye,
X as ActionX,
@@ -437,10 +440,16 @@ const Invoice = () => {
{selectedTopupIds.length > 0 && (
<div className='mt-3 p-3 bg-amber-50 dark:bg-amber-900/20 rounded-lg flex items-center justify-between'>
<span className='text-sm text-gray-600 dark:text-gray-300'>
{t('已选择')} {selectedTopupIds.length} {t('条记录')}
<Trans
t={t}
i18nKey='已选择 {{length}} 条记录'
values={{ length: selectedTopupIds.length }}
/>
</span>
<span className='text-lg font-bold text-amber-600 dark:text-amber-400'>
{t('合计')}: ¥{selectedAmount.toFixed(2)}
{t('合计')}
{I18N_TECHNICAL_TEXT.CNY_TOTAL_SEPARATOR}
{selectedAmount.toFixed(2)}
</span>
</div>
)}
@@ -611,7 +620,11 @@ const Invoice = () => {
{detailData.topup_list && detailData.topup_list.length > 0 && (
<div>
<Text className='text-sm text-gray-500 mb-2 block'>
{t('关联充值记录')} ({detailData.topup_list.length} {t('笔')})
<Trans
t={t}
i18nKey='关联充值记录 ({{length}} 笔)'
values={{ length: detailData.topup_list.length }}
/>
</Text>
<div className='space-y-1'>
{detailData.topup_list.map((topup) => (
+9 -3
View File
@@ -16,6 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { useTranslation } from 'react-i18next';
import React, { useEffect, useState } from 'react';
import {
Button,
@@ -35,6 +37,8 @@ import { articleHeadings, sanitizeArticleHtml } from './insightsContent';
import ArticleRichEditor from './ArticleRichEditor';
export default function ArticleEditor({ initial, insights, onApply, onClose }) {
const { t } = useTranslation();
const [draft, setDraft] = useState(initial);
const [errors, setErrors] = useState({});
const [processingImage, setProcessingImage] = useState(false);
@@ -96,7 +100,7 @@ export default function ArticleEditor({ initial, insights, onApply, onClose }) {
footer={
<div className='website-insights-editor-footer'>
<div className='flex gap-2'>
<Button onClick={close}>取消</Button>
<Button onClick={close}>{t('取消')}</Button>
<Button theme='solid' disabled={processingImage} onClick={apply}>
{processingImage ? '图片处理中' : '保存'}
</Button>
@@ -185,11 +189,13 @@ export default function ArticleEditor({ initial, insights, onApply, onClose }) {
'summary',
'文章描述',
<TextArea
aria-label='文章描述'
aria-label={t('文章描述')}
validateStatus={errors.summary ? 'error' : 'default'}
aria-invalid={Boolean(errors.summary)}
value={draft.summary}
placeholder='请输入文章描述,用于列表卡片摘要与详情页标题下方'
placeholder={t(
'请输入文章描述,用于列表卡片摘要与详情页标题下方',
)}
maxCount={200}
rows={3}
onChange={(value) => change('summary', value)}
+17 -13
View File
@@ -16,6 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { useTranslation } from 'react-i18next';
import TableEmpty from '../../components/common/table/TableEmpty';
import TableToolbar from '../../components/common/table/TableToolbar';
import { ConsoleFilterField } from '../../components/console/ConsoleModuleFilters';
@@ -47,6 +49,8 @@ import {
import ArticleEditor from './ArticleEditor';
export default function InsightsPanel({ value, onChange, disabled, error }) {
const { t } = useTranslation();
const [keyword, setKeyword] = useState('');
const [category, setCategory] = useState('all');
const [managing, setManaging] = useState(false);
@@ -188,7 +192,7 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
setArticle({ ...item, related: [...item.related] })
}
>
编辑
{t('编辑')}
</Button>
<Button
type='link'
@@ -198,7 +202,7 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
disabled={disabled || !sortable || index <= 0}
onClick={() => move(-1)}
>
上移
{t('上移')}
</Button>
<Button
type='link'
@@ -210,7 +214,7 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
}
onClick={() => move(1)}
>
下移
{t('下移')}
</Button>
<Button
type='link'
@@ -219,7 +223,7 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
disabled={disabled}
onClick={() => deleteArticle(item)}
>
删除
{t('删除')}
</Button>
</div>
);
@@ -251,7 +255,7 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
disabled={disabled}
onClick={() => setManaging(true)}
>
管理分类
{t('管理分类')}
</Button>
}
>
@@ -303,7 +307,7 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
disabled={disabled}
onClick={() => editCategory()}
>
新增分类
{t('新增分类')}
</Button>
</div>
</Card>
@@ -345,7 +349,7 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
setArticle(newArticle(activeCategory));
}}
>
新增文章
{t('新增文章')}
</Button>
</div>
</TableToolbar>
@@ -376,7 +380,7 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
disabled={disabled}
onClick={() => editCategory()}
>
新增分类
{t('新增分类')}
</Button>
}
>
@@ -384,7 +388,7 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
“全部内容”为官网默认筛选项,汇总展示全部文章,不能作为文章分类;已有文章的分类需先将文章调整到其他分类再删除。
</Typography.Paragraph>
<div className='website-insights-manage-row'>
<span>全部内容</span>
<span>{t('全部内容')}</span>
<Typography.Text type='tertiary'>
默认筛选项(不可删除)
</Typography.Text>
@@ -392,7 +396,7 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
{value.categories.map((c) => (
<div className='website-insights-manage-row' key={c.id}>
<span>
{c.name}({count(c.id)} 篇)
{c.name}({count(c.id)} {t('篇)')}
</span>
<Button
type='tertiary'
@@ -400,7 +404,7 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
disabled={disabled}
onClick={() => editCategory(c)}
>
编辑
{t('编辑')}
</Button>
<Button
theme='borderless'
@@ -408,7 +412,7 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
disabled={disabled}
onClick={() => deleteCategory(c)}
>
删除
{t('删除')}
</Button>
</div>
))}
@@ -433,7 +437,7 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
htmlFor='website-category-name'
className='website-category-dialog-label'
>
分类名称 <span aria-hidden='true'>*</span>
{t('分类名称')} <span aria-hidden='true'>*</span>
</label>
<Input
id='website-category-name'
+3 -2
View File
@@ -23,6 +23,7 @@ For commercial licensing, please contact support@quantumnous.com
// 结构:hero(版本/动作)→ 为你推荐 → 客户端能做什么 → 全部安装包 → 三步开始。
// 加载失败 / 未开放 / 暂无安装包三种状态都保留 hero 与说明区,只替换安装包区域。
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import {
Download as ActionDownload,
RefreshCw as ActionRefreshCw,
@@ -540,7 +541,7 @@ const WeyAiDownload = ({ embedded = false }) => {
<div className='wd-file'>
<div className='wd-file__main'>
<div className='wd-file__title'>
<span>Android</span>
<span>{I18N_TECHNICAL_TEXT.ANDROID}</span>
<Tag size='small'>apk</Tag>
</div>
<span className='wd-file__meta' title={androidApk.name}>
@@ -585,7 +586,7 @@ const WeyAiDownload = ({ embedded = false }) => {
<div className='min-w-0'>
<div className='wd-eyebrow'>
<MonitorDown size={14} aria-hidden='true' />
WeyAi Desktop
{I18N_TECHNICAL_TEXT.WEYAI_DESKTOP}
</div>
<h1>{t('下载 WeyAi 桌面端')}</h1>
<p>{t('用你的账号登录,直接使用平台提供的模型和余额')}</p>