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

补齐页面缺译,统一动态文案的整句插值方式。
This commit is contained in:
zhanjunhao
2026-11-17 14:10:25 +08:00
parent ef3f405190
commit 67969a041d
146 changed files with 16591 additions and 11007 deletions
@@ -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 } from 'react';
import { Card, Table, Progress } from '@/components/ui';
import { renderQuota } from '../../helpers';
@@ -131,7 +132,7 @@ const ChannelConsumption = ({ data, title, icon, t, embedded = false }) => {
<span className='text-brand'>{icon}</span>
<span className='font-semibold'>{title}</span>
<span className='text-xs text-gray-400 ml-2'>
TOP {data.length}
{I18N_TECHNICAL_TEXT.TOP} {data.length}
</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 React, { useState } from 'react';
import {
Table,
@@ -176,7 +177,11 @@ const RiskControlBanLogs = ({
<div className='mb-3 flex items-center justify-between flex-wrap gap-2'>
<Space>
<Text type='tertiary' size='small'>
{t('共')} {banLogTotal || 0} {t('条')}
<Trans
t={t}
i18nKey='共 {{value}} 条'
values={{ value: banLogTotal || 0 }}
/>
</Text>
<Select
value={banLogStatus}
@@ -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, useRef, useState } from 'react';
import {
Modal,
@@ -267,8 +268,11 @@ const RiskControlRulesModal = ({
<span>
{t('总消耗 ≤')}{' '}
<Text type='tertiary' size='small'>
({t('quota')}, ≈ {renderQuota(form.ban_max_total_quota, 4)},{' '}
{t('防误伤大客户')})
<Trans
t={t}
i18nKey='(quota, ≈ {{value}}, 防误伤大客户)'
values={{ value: renderQuota(form.ban_max_total_quota, 4) }}
/>
</Text>
</span>
}
@@ -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, { useMemo } from 'react';
import { Card } from '@/components/ui';
import { VChart } from '@visactor/react-vchart';
@@ -143,7 +144,8 @@ const TopupChannelChart = ({ data, title, icon, t }) => {
¥{(item.amount || 0).toFixed(2)}
</span>
<span className='text-gray-400 text-xs ml-2'>
({item.percent?.toFixed(1)}%)
({item.percent?.toFixed(1)}
{I18N_TECHNICAL_TEXT.PERCENT_CLOSE}
</span>
</div>
</div>
+11 -2
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 React from 'react';
import { Card, Avatar, Progress } from '@/components/ui';
import { renderQuota } from '../../helpers';
@@ -71,7 +73,11 @@ const UserRanking = ({ data, title, icon, t }) => {
<span className='text-brand'>{icon}</span>
<span className='font-semibold'>{title}</span>
<span className='text-xs text-gray-400 ml-2'>
{t('共')} {data.length} {t('人')}
<Trans
t={t}
i18nKey='共 {{length}} 人'
values={{ length: data.length }}
/>
</span>
</div>
}
@@ -120,7 +126,10 @@ const UserRanking = ({ data, title, icon, t }) => {
<span>
{item.requests?.toLocaleString()} {t('次请求')}
</span>
<span>{(item.tokens || 0).toLocaleString()} tokens</span>
<span>
{(item.tokens || 0).toLocaleString()}{' '}
{I18N_TECHNICAL_TEXT.TOKENS}
</span>
</div>
<div className='flex justify-between text-xs mt-1'>
<span className='text-gray-500'>{t('余额')}:</span>
@@ -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 from 'react';
import { Card, Table } from '@/components/ui';
import { renderQuota } from '../../helpers';
@@ -82,7 +85,7 @@ const UserTopupRanking = ({ data, title, icon, t, embedded = false }) => {
{text || `User ${record.user_id}`}
</span>
<span className='text-xs text-gray-400 truncate'>
ID: {record.user_id}
{I18N_TECHNICAL_TEXT.ID} {record.user_id}
</span>
</div>
),
@@ -132,7 +135,11 @@ const UserTopupRanking = ({ data, title, icon, t, embedded = false }) => {
<span className='text-brand'>{icon}</span>
<span className='font-semibold'>{title}</span>
<span className='text-xs text-gray-400 ml-2'>
{t('共')} {data.length} {t('人')}
<Trans
t={t}
i18nKey='共 {{length}} 人'
values={{ length: data.length }}
/>
</span>
</div>
)
Binary file not shown.
@@ -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 { Download as ActionDownload } from '@/components/common/icons/ActionIcons';
import React from 'react';
import { Banner, Button, Card, Tag, Tooltip } from '@/components/ui';
@@ -47,9 +49,17 @@ export const ReportHeader = ({ report, onExport, t }) => {
{t('企业经营决策报表')}
</div>
<div className='text-sm text-gray-700 dark:text-gray-200 tabular-nums'>
{t('本期')}:{formatCst(m.start)} ~ {formatCst(m.effective_end)}
<span className='mx-2 text-gray-300'>|</span>
{t('对比期')}:{formatCst(m.prev_start)} ~ {formatCst(m.prev_end)}
<Trans
t={t}
i18nKey='本期:{{value}} ~ {{value2}}<part0>|</part0>对比期:{{value3}} ~ {{value4}}'
values={{
value: formatCst(m.start),
value2: formatCst(m.effective_end),
value3: formatCst(m.prev_start),
value4: formatCst(m.prev_end),
}}
components={{ part0: <span className='mx-2 text-gray-300' /> }}
/>
</div>
<div className='text-xs text-gray-500 dark:text-gray-400 mt-1'>
{t('数据截至 {{time}},按整点统计;对比期与本期按相同时长对齐', {
@@ -281,7 +291,8 @@ export const KpiGrid = ({ report, lists, cny, onJump, t }) => {
}}
>
{shareDelta >= 0 ? '+' : ''}
{shareDelta.toFixed(1)}pp
{shareDelta.toFixed(1)}
{I18N_TECHNICAL_TEXT.PERCENTAGE_POINTS}
</span>
),
tip: t('企业消耗 /(企业 + 个人消耗);pp 为百分点变化'),
+31 -27
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 { useTranslation } from 'react-i18next';
import React from 'react';
import { Sparkles } from 'lucide-react';
@@ -37,34 +38,37 @@ const AuthCardHeader = ({
logoNode,
wrapperClassName = 'mb-5',
logoWrapperClassName = 'mb-3',
}) => (
<div
className={`flex flex-col items-center justify-center ${wrapperClassName}`}
>
<div className={`relative ${logoWrapperClassName}`}>
{/* Logo 光环 */}
<div className='absolute -inset-1.5 bg-gradient-to-r from-brand-from/30 to-brand-to/30 rounded-xl blur-md opacity-60' />
<div className='relative p-2 bg-white dark:bg-neutral-800 rounded-xl shadow-md'>
{logoNode || (
<img
src={logo}
alt='Logo'
className='h-10 w-10 rounded-lg object-cover'
/>
)}
}) => {
const { t } = useTranslation();
return (
<div
className={`flex flex-col items-center justify-center ${wrapperClassName}`}
>
<div className={`relative ${logoWrapperClassName}`}>
{/* Logo 光环 */}
<div className='absolute -inset-1.5 bg-gradient-to-r from-brand-from/30 to-brand-to/30 rounded-xl blur-md opacity-60' />
<div className='relative p-2 bg-white dark:bg-neutral-800 rounded-xl shadow-md'>
{logoNode || (
<img
src={logo}
alt={t('网站标志')}
className='h-10 w-10 rounded-lg object-cover'
/>
)}
</div>
<Sparkles
size={14}
className='absolute -top-0.5 -right-0.5 text-amber-400 motion-safe:animate-pulse'
/>
</div>
<Sparkles
size={14}
className='absolute -top-0.5 -right-0.5 text-amber-400 motion-safe:animate-pulse'
/>
<h4 className='text-xl font-bold text-gray-800 dark:text-white tracking-tight mb-0.5'>
{title}
</h4>
<p className='auth-card-subtitle text-gray-500 dark:text-gray-400 text-xs'>
{subtitle}
</p>
</div>
<h4 className='text-xl font-bold text-gray-800 dark:text-white tracking-tight mb-0.5'>
{title}
</h4>
<p className='auth-card-subtitle text-gray-500 dark:text-gray-400 text-xs'>
{subtitle}
</p>
</div>
);
);
};
export default AuthCardHeader;
+1 -1
View File
@@ -704,7 +704,7 @@ const LoginForm = () => {
<Suspense
fallback={
<div className='flex justify-center my-2 h-10 items-center text-gray-400 text-xs'>
Loading...
{t('加载中...')}
</div>
}
>
+5 -1
View File
@@ -122,7 +122,11 @@ const PasswordResetConfirm = () => {
<div className='flex flex-col items-center'>
<div className='w-full max-w-md'>
<div className='flex items-center justify-center mb-6 gap-2'>
<img src={logo} alt='Logo' className='h-10 rounded-full' />
<img
src={logo}
alt={t('网站标志')}
className='h-10 rounded-full'
/>
<Title heading={3} className='!text-gray-800'>
{systemName}
</Title>
+5 -1
View File
@@ -118,7 +118,11 @@ const PasswordResetForm = () => {
<div className='flex flex-col items-center'>
<div className='w-full max-w-md'>
<div className='flex items-center justify-center mb-6 gap-2'>
<img src={logo} alt='Logo' className='h-10 rounded-full' />
<img
src={logo}
alt={t('网站标志')}
className='h-10 rounded-full'
/>
<Title heading={3} className='!text-gray-800'>
{systemName}
</Title>
+1 -1
View File
@@ -580,7 +580,7 @@ const RegisterForm = () => {
<Suspense
fallback={
<div className='flex justify-center my-2 h-10 items-center text-gray-400 text-xs'>
Loading...
{t('加载中...')}
</div>
}
>
+21 -8
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 { API, showError, showSuccess } from '../../helpers';
import { Button, Card, Divider, Form, Typography } from '@/components/ui';
import React, { useState } from 'react';
@@ -133,10 +134,16 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
<div className='bg-gray-50 dark:bg-gray-800 rounded-lg p-3'>
<Text size='small' type='secondary'>
<strong>{t('提示:')}</strong>
<br />• {t('验证码每30秒更新一次')}
<br />• {t('如果无法获取验证码,请使用备用码')}
<br />• {t('每个备用码只能使用一次')}
<Trans
t={t}
i18nKey='<part0>提示:</part0><part1/>• 验证码每30秒更新一次<part2/>• 如果无法获取验证码,请使用备用码<part3/>• 每个备用码只能使用一次'
components={{
part0: <strong />,
part1: <br />,
part2: <br />,
part3: <br />,
}}
/>
</Text>
</div>
</div>
@@ -223,10 +230,16 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
}}
>
<Text size='small' type='secondary'>
<strong>{t('提示:')}</strong>
<br />• {t('验证码每30秒更新一次')}
<br />• {t('如果无法获取验证码,请使用备用码')}
<br />• {t('每个备用码只能使用一次')}
<Trans
t={t}
i18nKey='<part0>提示:</part0><part1/>• 验证码每30秒更新一次<part2/>• 如果无法获取验证码,请使用备用码<part3/>• 每个备用码只能使用一次'
components={{
part0: <strong />,
part1: <br />,
part2: <br />,
part3: <br />,
}}
/>
</Text>
</div>
</Card>
+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 i18next from 'i18next';
import React from 'react';
import Loading from './ui/Loading';
import {
@@ -73,7 +75,7 @@ class ChunkErrorBoundary extends React.Component {
: 'Please refresh the page and try again.'}
</p>
<button type='button' onClick={() => window.location.reload()}>
Refresh
{i18next.t('刷新')}
</button>
</div>
</div>
+8 -3
View File
@@ -30,6 +30,7 @@ For commercial licensing, please contact support@quantumnous.com
* 页面只需 usePageGuide({...配置}) 后把三个组件放到对应位置;
* steps[].done 传布尔值即启用进度跟踪,不传则渲染为纯阅读步骤。
*/
import { Trans } from 'react-i18next';
import {
BookOpenText as ActionBookOpenText,
Compass as ActionCompass,
@@ -201,9 +202,13 @@ export const PageGuidePill = ({ guide, className = '' }) => {
{t('快速上手')} {progress.doneCount}/{progress.total}
{' · '}
<strong>
{t('下一步')}
{t(':')}
{nextStep?.working ? t('进行中') : nextStep?.title}
<Trans
t={t}
i18nKey='下一步:{{value}}'
values={{
value: nextStep?.working ? t('进行中') : nextStep?.title,
}}
/>
</strong>
</span>
<span className='page-guide-pill-go'>{t('继续')} →</span>
+10 -6
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, useRef, useState } from 'react';
import Quill, { Delta } from 'quill/core';
import BoldFormat from 'quill/formats/bold';
@@ -69,6 +71,8 @@ export default function RichTextEditor({
placeholder = '',
maxLength,
}) {
const { t } = useTranslation();
const host = useRef(null);
const picker = useRef(null);
const instance = useRef(null);
@@ -438,7 +442,7 @@ export default function RichTextEditor({
<div
className='rich-text-toolbar'
role='toolbar'
aria-label='富文本工具栏'
aria-label={t('富文本工具栏')}
>
<select
aria-label='段落格式'
@@ -450,9 +454,9 @@ export default function RichTextEditor({
)
}
>
<option value=''>正文段落</option>
<option value='2'>二级标题</option>
<option value='3'>三级标题</option>
<option value=''>{t('正文段落')}</option>
<option value='2'>{t('二级标题')}</option>
<option value='3'>{t('三级标题')}</option>
</select>
{tools.map(([name, Icon, command, selected = false]) => (
<button
@@ -471,8 +475,8 @@ export default function RichTextEditor({
<button
className='app-action-button'
type='button'
title='插入正文图片(单张不超过 2 MB)'
aria-label='插入正文图片'
title={t('插入正文图片(单张不超过 2 MB)')}
aria-label={t('插入正文图片')}
disabled={disabled || busy}
onMouseDown={(event) => event.preventDefault()}
onClick={() => {
@@ -43,7 +43,7 @@ const HeaderLogo = ({
<SkeletonWrapper loading={isLoading || !logoLoaded} type='image' />
<img
src={logo}
alt='logo'
alt={t('网站标志')}
className={`absolute inset-0 w-full h-full object-contain ${!isLoading && logoLoaded ? 'opacity-100' : 'opacity-0'}`}
/>
</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 React from 'react';
import { Button as AntButton } from 'antd';
import { Dropdown } from '@/components/ui';
@@ -51,7 +52,11 @@ const NewYearButton = ({ isNewYear, t }) => {
>
<AntButton
type='text'
icon={<span className='text-xl'>🎉</span>}
icon={
<span className='text-xl'>
{I18N_TECHNICAL_TEXT.CELEBRATION_ICON}
</span>
}
aria-label={t('新年快乐')}
className='ui-header-icon-action'
/>
+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 {
EyeOff as ActionEyeOff,
Eye as ActionEye,
@@ -909,7 +910,7 @@ const ChatArea = ({
className='flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-brand/95 dark:bg-brand-deep/30 backdrop-blur-sm border border-brand/80 dark:border-brand-deep/60 shadow-md text-xs text-brand-deep dark:text-brand-from hover:bg-brand/95 dark:hover:bg-brand-deep/50 transition'
aria-label={t('查看对话历史摘要')}
>
<span>📝</span>
<span>{I18N_TECHNICAL_TEXT.NOTE_ICON}</span>
<span>{t('历史已压缩,点击查看摘要')}</span>
</button>
</Popover>
+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 {
Copy as ActionCopy,
ChevronUp as ActionChevronUp,
@@ -344,13 +345,13 @@ const CodeViewer = ({ content, title, language = 'json' }) => {
<span
style={{ fontSize: '11px', opacity: 0.7, marginLeft: '4px' }}
>
(+
{I18N_TECHNICAL_TEXT.ADDITIONAL_TOKENS_PREFIX}
{Math.round(
(contentMetrics.length -
PERFORMANCE_CONFIG.PREVIEW_LENGTH) /
1000,
)}
K)
{I18N_TECHNICAL_TEXT.THOUSAND_TOKENS_SUFFIX}
</span>
)}
</Button>
@@ -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 {
AlertTriangle as ActionAlertTriangle,
RotateCw as ActionRotateCw,
@@ -274,7 +275,8 @@ const AttachmentChip = ({ file, onRemove, onRestore, onRetry, t }) => {
</Tooltip>
{isUploading ? (
<span className='text-[10px] text-gray-400 dark:text-gray-500 tabular-nums'>
{Math.round((file.progress || 0) * 100)}% · {formatBytes(file.size)}
{Math.round((file.progress || 0) * 100)}
{I18N_TECHNICAL_TEXT.PERCENT_SEPARATOR} {formatBytes(file.size)}
</span>
) : isFailed ? (
<Tooltip content={file.error || t('上传失败')}>
@@ -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 { Edit as ActionEdit } from '@/components/common/icons/ActionIcons';
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
import React, { useState, useEffect } from 'react';
@@ -184,7 +185,7 @@ const CustomRequestEditor = ({
<TextArea
value={localValue}
onChange={handleValueChange}
placeholder='{"model": "gpt-4o", "messages": [...], ...}'
placeholder={I18N_TECHNICAL_TEXT.REQUEST_BODY_EXAMPLE}
autosize={{ minRows: 8, maxRows: 20 }}
className={`custom-request-textarea !rounded-lg font-mono text-sm ${!isValid ? '!border-red-500' : ''}`}
style={{
+3 -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 { X as ActionX } from '@/components/common/icons/ActionIcons';
import React, { useState, useEffect } from 'react';
import {
@@ -186,7 +187,8 @@ const DebugPanel = ({
{t('响应')}
{debugData.sseMessages && debugData.sseMessages.length > 0 && (
<span className='px-1.5 py-0.5 text-xs bg-blue-100 text-blue-600 rounded-full'>
SSE ({debugData.sseMessages.length})
{I18N_TECHNICAL_TEXT.SSE_COUNT_PREFIX}
{debugData.sseMessages.length})
</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 { useTranslation } from 'react-i18next';
import {
ZoomOut as ActionZoomOut,
ZoomIn as ActionZoomIn,
@@ -28,6 +29,8 @@ import React, { useState, useCallback, useEffect } from 'react';
import { Modal } from '@/components/ui';
const ImagePreviewModal = ({ visible, imageUrl, onClose }) => {
const { t } = useTranslation();
const [scale, setScale] = useState(1);
useEffect(() => {
@@ -122,7 +125,7 @@ const ImagePreviewModal = ({ visible, imageUrl, onClose }) => {
className={['app-action-button', btnClass]
.filter(Boolean)
.join(' ')}
title='Reset'
title={t('重置')}
>
<ActionRotateCw size={16} />
</button>
@@ -160,7 +163,7 @@ const ImagePreviewModal = ({ visible, imageUrl, onClose }) => {
>
<img
src={imageUrl}
alt='preview'
alt={t('预览')}
style={{
transform: `scale(${scale})`,
transition: 'transform 0.2s ease',
+9 -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 {
Plus as ActionPlus,
X as ActionX,
@@ -106,8 +107,14 @@ const ImageUrlInput = ({
</Typography.Text>
) : (
<Typography.Text className='text-xs text-gray-500 mb-2 block'>
{t('已添加')} {imageUrls.length} {t('张图片')}
{disabled ? ` (${t('自定义模式下不可用')})` : ''}
<Trans
t={t}
i18nKey='已添加 {{length}} 张图片{{value}}'
values={{
length: imageUrls.length,
value: disabled ? ` (${t('自定义模式下不可用')})` : '',
}}
/>
</Typography.Text>
)}
+4 -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 {
X as ActionX,
Check as ActionCheck,
@@ -378,7 +379,9 @@ const MessageContent = ({
key={`img-${i}`}
className='inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-white/70 dark:bg-neutral-800/70 border border-amber-200/60 dark:border-amber-800/30 text-[11px] text-gray-700 dark:text-gray-200'
>
<span className='text-blue-500'>🖼</span>
<span className='text-blue-500'>
{I18N_TECHNICAL_TEXT.IMAGE_ICON}
</span>
{t('图片')}
</span>
);
+4 -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 {
Copy as ActionCopy,
ChevronUp as ActionChevronUp,
@@ -283,7 +284,9 @@ const SSEViewer = ({ sseData }) => {
<div className='flex items-center gap-2'>
<Badge count={`#${item.index + 1}`} type='tertiary' />
{item.isDone ? (
<span className='text-green-600 font-medium'>[DONE]</span>
<span className='text-green-600 font-medium'>
{I18N_TECHNICAL_TEXT.DONE}
</span>
) : item.error ? (
<span className='text-red-600'>{t('解析错误')}</span>
) : (
+13 -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 React, { useEffect, useMemo, useRef, useState } from 'react';
import { Spin, Tooltip } from '@/components/ui';
import { Grid3x3 } from 'lucide-react';
@@ -71,7 +73,7 @@ const QualityHeatmap = ({ quality, t }) => {
</span>
</span>
<div className='quality-heatmap-legend'>
<span>0%</span>
<span>{I18N_TECHNICAL_TEXT.ZERO_PERCENT}</span>
{[0, 25, 50, 75, 100].map((lvl) => (
<span
key={lvl}
@@ -79,7 +81,7 @@ const QualityHeatmap = ({ quality, t }) => {
style={{ '--cell-level': `${lvl}%`, cursor: 'default' }}
/>
))}
<span>≥50%</span>
<span>{I18N_TECHNICAL_TEXT.AT_LEAST_50_PERCENT}</span>
</div>
</div>
<div className='quality-card-body'>
@@ -137,10 +139,15 @@ const QualityHeatmap = ({ quality, t }) => {
<div>{name}</div>
<div>{fmtTs(ts)}</div>
<div>
{t('请求数')} {fmtInt(cell.total)} ·{' '}
{t('上游故障')}{' '}
{fmtInt(cell.upstream_fault)} (
{pct(cell.upstream_fault_rate)})
<Trans
t={t}
i18nKey='请求数 {{value}} · 上游故障 {{value2}} ({{value3}})'
values={{
value: fmtInt(cell.total),
value2: fmtInt(cell.upstream_fault),
value3: pct(cell.upstream_fault_rate),
}}
/>
</div>
</div>
}
+17 -9
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 React, { useMemo } from 'react';
import { Button, Skeleton, Tooltip } from '@/components/ui';
import { useActualTheme } from '../../context/Theme';
@@ -241,7 +243,9 @@ export const QualityKpiCards = ({ summary, loading, onDrillOutcome, t }) => {
color: toneColor('tertiary'),
foot: (
<>
<span>P50 {fmtMs(cur.p50_ms)}</span>
<span>
{I18N_TECHNICAL_TEXT.P50} {fmtMs(cur.p50_ms)}
</span>
<span>
{t('平均')} {fmtMs(cur.avg_ms)}
</span>
@@ -401,14 +405,18 @@ export const QualityTrendChart = ({ trend, loading, onZoom, t }) => {
<Activity size={16} />
{t('调用结局趋势')}
<span className='quality-card-sub'>
{t('粒度')}{' '}
{gran >= 86400
? t('1 天')
: gran >= 3600
? t('1 小时')
: t('5 分钟')}
{' · '}
{t('点击柱子放大到该时段')}
<Trans
t={t}
i18nKey='粒度 {{value}} · 点击柱子放大到该时段'
values={{
value:
gran >= 86400
? t('1 天')
: gran >= 3600
? t('1 小时')
: t('5 分钟'),
}}
/>
</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 { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import { TestTube2 as ActionTestTube2 } from '@/components/common/icons/ActionIcons';
import {
RefreshCw as ActionRefreshCw,
@@ -609,13 +610,13 @@ export default function ContentGuardSetting() {
icon={<ActionTestTube2 size={16} />}
onClick={() => testPermission('moderate')}
>
moderate
{I18N_TECHNICAL_TEXT.MODERATE}
</Button>
<Button
icon={<ActionTestTube2 size={16} />}
onClick={() => testPermission('stream_moderate')}
>
stream_moderate
{I18N_TECHNICAL_TEXT.STREAM_MODERATE}
</Button>
</Space>
</Form>
+3 -1
View File
@@ -119,7 +119,9 @@ const DashboardSetting = () => {
setShowMigrateModal(false);
} catch (err) {
console.error(err);
showError(t('迁移失败: ') + (err.message || t('未知错误')));
showError(
t('迁移失败: {{value}}', { value: err.message || t('未知错误') }),
);
} finally {
setLoading(false);
}
@@ -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, { useEffect, useRef, useState } from 'react';
import {
@@ -593,7 +594,9 @@ export default function DataSecuritySetting() {
const deleting = ORG_DELETE_TYPES.has(request.req_type);
return (
<div className='text-xs leading-5 min-w-[320px]'>
<div className='font-medium mb-1'>OrgId: {orgId}</div>
<div className='font-medium mb-1'>
{I18N_TECHNICAL_TEXT.ORGID} {orgId}
</div>
{ORG_POLICY_FIELDS.map(([field, label]) => {
const currentValue = formatOrgPolicyValue(field, current[field]);
const requestedValue = formatOrgPolicyValue(
@@ -1291,7 +1294,7 @@ export default function DataSecuritySetting() {
<Form.Input
field='pattern'
label={t('正则表达式(RE2)')}
placeholder={t('例如') + ' EMP[0-9]{6}'}
placeholder={t('例如 EMP[0-9]{6}')}
rules={[{ required: true, message: t('正则不能为空') }]}
/>
<Form.Select
+37 -22
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 { Eraser as ActionEraser } from '@/components/common/icons/ActionIcons';
import {
Plus as ActionPlus,
@@ -677,7 +678,9 @@ const LevelPolicySetting = () => {
if (s === '') continue;
const num = Number(s);
if (!Number.isFinite(num) || num <= 0) {
return showError(t('分组折扣系数必须为大于 0 的数字') + `:${g}`);
return showError(
t('分组折扣系数必须为大于 0 的数字{{value}}', { value: `:${g}` }),
);
}
groupDiscount[g] = num;
}
@@ -692,7 +695,9 @@ const LevelPolicySetting = () => {
const num = Number(s);
if (s === '' || !Number.isFinite(num) || num <= 0) {
return showError(
t('模型折扣系数必须为大于 0 的数字') + `:${g}/${m}`,
t('模型折扣系数必须为大于 0 的数字{{value}}', {
value: `:${g}/${m}`,
}),
);
}
parsed[m] = num;
@@ -761,13 +766,20 @@ const LevelPolicySetting = () => {
} else {
const d = res?.data?.data || {};
const refs = [];
if (d.users) refs.push(t('用户') + ': ' + d.users);
if (d.organizations) refs.push(t('企业') + ': ' + d.organizations);
if (d.users) refs.push(t('用户: {{users}}', { users: d.users }));
if (d.organizations)
refs.push(
t('企业: {{organizations}}', { organizations: d.organizations }),
);
if (d.default_options?.length)
refs.push(t('默认等级') + ': ' + d.default_options.join(','));
refs.push(
t('默认等级: {{value}}', { value: d.default_options.join(',') }),
);
showError(
(res?.data?.message || t('删除失败')) +
(refs.length ? ` [${refs.join(' / ')}]` : ''),
t('{{value}}{{value2}}', {
value: res?.data?.message || t('删除失败'),
value2: refs.length ? ` [${refs.join(' / ')}]` : '',
}),
);
}
} catch (err) {
@@ -1223,8 +1235,10 @@ const LevelPolicySetting = () => {
title={
isNew
? t('新增{{type}}', { type: typeLabel(editorType) })
: t('编辑{{type}}', { type: typeLabel(editorType) }) +
` · ${form.name || editingCode} (${editingCode})`
: t('编辑{{type}}{{value}}', {
type: typeLabel(editorType),
value: ` · ${form.name || editingCode} (${editingCode})`,
})
}
visible={editorVisible}
onCancel={closeEditor}
@@ -1477,19 +1491,20 @@ const LevelPolicySetting = () => {
{/* ===== 分组策略(折扣 + 可见性) ===== */}
<Title heading={6}>{t('分组策略')}</Title>
<Text type='tertiary' size='small'>
{editorType === 'enterprise'
? t(
'折扣系数 <=1 表示打折,在分组倍率基础上相乘,仅对企业 Token 计费生效;留空表示该分组不打折。写入既有企业折扣矩阵,计费口径不变。',
)
: t(
'折扣系数 <=1 表示打折,在分组倍率基础上相乘,对该个人等级用户计费生效;留空表示该分组不打折。',
)}{' '}
{t(
'「隐藏」开启后:该等级用户在市场页、密钥创建下拉中看不到该分组,显式选用的密钥在调用时会被拒绝(403);auto 路由也会绕开。例外:分组等于用户自身分组(企业为作用域默认分组)的密钥不受影响,避免误配切断存量流量(用户分组事后迁移则豁免随之失效)。',
)}{' '}
{t(
'点击「模型折扣」列可展开分组行,为指定模型单独设置折扣系数——命中的模型直接按覆盖系数计费(替换分组折扣,不叠乘)。',
)}
<Trans
t={t}
i18nKey='{{value}} 「隐藏」开启后:该等级用户在市场页、密钥创建下拉中看不到该分组,显式选用的密钥在调用时会被拒绝(403);auto 路由也会绕开。例外:分组等于用户自身分组(企业为作用域默认分组)的密钥不受影响,避免误配切断存量流量(用户分组事后迁移则豁免随之失效)。 点击「模型折扣」列可展开分组行,为指定模型单独设置折扣系数——命中的模型直接按覆盖系数计费(替换分组折扣,不叠乘)。'
values={{
value:
editorType === 'enterprise'
? t(
'折扣系数 <=1 表示打折,在分组倍率基础上相乘,仅对企业 Token 计费生效;留空表示该分组不打折。写入既有企业折扣矩阵,计费口径不变。',
)
: t(
'折扣系数 <=1 表示打折,在分组倍率基础上相乘,对该个人等级用户计费生效;留空表示该分组不打折。',
),
}}
/>
</Text>
<Table
// 嵌在 358px 的弹窗体里,列宽合计 460~480px,必须给横向滚动
+1 -1
View File
@@ -214,7 +214,7 @@ const OperationSetting = () => {
const errorBanner = loadError && (
<Banner type='danger' closeIcon={null} description={loadError}>
<Button onClick={onRefresh} disabled={loading}>
重新加载运营设置
{t('重新加载运营设置')}
</Button>
</Banner>
);
+1 -1
View File
@@ -602,7 +602,7 @@ const OtherSetting = () => {
</Form>
</Col>
<Modal
title={t('新版本') + ':' + updateData.tag_name}
title={t('新版本:{{tag_name}}', { tag_name: updateData.tag_name })}
visible={showUpdateModal}
onCancel={() => setShowUpdateModal(false)}
footer={
+3 -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 { Check as ActionCheck } from '@/components/common/icons/ActionIcons';
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
import { writeClipboardText } from '../../helpers/clipboard';
@@ -634,7 +635,8 @@ const PersonalSetting = () => {
className='app-action-button ui-profile-id'
onClick={copyUserId}
>
ID:{userState?.user?.id}
{I18N_TECHNICAL_TEXT.ID_PREFIX_CJK}
{userState?.user?.id}
{userIdCopied && <ActionCheck size={12} />}
</button>
</Tooltip>
+29 -31
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 React, { useEffect, useState, useRef } from 'react';
import {
Button,
@@ -1636,20 +1637,24 @@ const SystemSetting = () => {
<Card>
<Form.Section text={t('配置 Linux DO OAuth')}>
<Text>
{t('用以支持通过 Linux DO 进行登录注册')}
<a
href='https://connect.linux.do/'
target='_blank'
rel='noreferrer'
style={{
display: 'inline-block',
marginLeft: 4,
marginRight: 4,
<Trans
t={t}
i18nKey='用以支持通过 Linux DO 进行登录注册<part0>点击此处</part0>管理你的 LinuxDO OAuth App'
components={{
part0: (
<a
href='https://connect.linux.do/'
target='_blank'
rel='noreferrer'
style={{
display: 'inline-block',
marginLeft: 4,
marginRight: 4,
}}
/>
),
}}
>
{t('点击此处')}
</a>
{t('管理你的 LinuxDO OAuth App')}
/>
</Text>
<Banner
type='info'
@@ -1732,13 +1737,10 @@ const SystemSetting = () => {
</Text>
<Banner
type='info'
description={
t(
'需要在微信开放平台创建网站应用并通过审核,回调地址配置为:',
) +
window.location.origin +
'/oauth/wechat-open'
}
description={t(
'需要在微信开放平台创建网站应用并通过审核,回调地址配置为:{{origin}}/oauth/wechat-open',
{ origin: window.location.origin },
)}
style={{ marginBlock: '16px' }}
/>
<Row
@@ -1775,17 +1777,13 @@ const SystemSetting = () => {
</Text>
<Banner
type='info'
description={
t(
'需要已认证的微信公众号,并在公众号后台「设置与开发 > 公众号设置 > 功能设置」中配置网页授权域名为:',
) +
window.location.hostname +
t(
'。如果公众号已绑定到微信开放平台,用户的 UnionID 将与扫码登录共享,确保同一用户身份。回调地址为:',
) +
window.location.origin +
'/oauth/wechat-mp'
}
description={t(
'需要已认证的微信公众号,并在公众号后台「设置与开发 > 公众号设置 > 功能设置」中配置网页授权域名为:{{hostname}}。如果公众号已绑定到微信开放平台,用户的 UnionID 将与扫码登录共享,确保同一用户身份。回调地址为:{{origin}}/oauth/wechat-mp',
{
hostname: window.location.hostname,
origin: window.location.origin,
},
)}
style={{ marginBlock: '16px' }}
/>
<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, { useState, useEffect } from 'react';
import {
Empty,
@@ -259,9 +260,14 @@ const ModelsList = ({ t, models, modelsLoading, copyText }) => {
onClick={() => setIsModelsExpanded(true)}
icon={<IconChevronDown />}
>
{t('更多')}{' '}
{filteredModels.length - MODELS_DISPLAY_COUNT}{' '}
{t('个模型')}
<Trans
t={t}
i18nKey='更多 {{value}} 个模型'
values={{
value:
filteredModels.length - MODELS_DISPLAY_COUNT,
}}
/>
</Tag>
</Space>
)}
@@ -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, { useRef, useEffect, useState, useContext } from 'react';
import {
Button,
@@ -513,22 +514,26 @@ const NotificationSettings = ({
</div>
<div className='text-xs text-gray-500 leading-relaxed'>
<div>
<strong>type:</strong>{' '}
<strong>{I18N_TECHNICAL_TEXT.TYPE}</strong>{' '}
{t('通知类型 (quota_exceed: 额度预警)')}{' '}
</div>
<div>
<strong>title:</strong> {t('通知标题')}
<strong>{I18N_TECHNICAL_TEXT.TITLE}</strong>{' '}
{t('通知标题')}
</div>
<div>
<strong>content:</strong>{' '}
{t('通知内容,支持 {{value}} 变量占位符')}
<strong>{I18N_TECHNICAL_TEXT.CONTENT}</strong>{' '}
{t('通知内容,支持 {{value}} 变量占位符', {
value: '{{value}}',
})}
</div>
<div>
<strong>values:</strong>{' '}
<strong>{I18N_TECHNICAL_TEXT.VALUES}</strong>{' '}
{t('按顺序替换content中的变量占位符')}
</div>
<div>
<strong>timestamp:</strong> {t('Unix时间戳')}
<strong>{I18N_TECHNICAL_TEXT.TIMESTAMP}</strong>{' '}
{t('Unix时间戳')}
</div>
</div>
</div>
@@ -544,11 +549,13 @@ const NotificationSettings = ({
label={t('Bark推送URL')}
placeholder={t(
'请输入Bark推送URL,例如: https://api.day.app/yourkey/{{title}}/{{content}}',
{ title: '{{title}}', content: '{{content}}' },
)}
onChange={(val) => handleFormChange('barkUrl', val)}
prefix={<IconLink />}
extraText={t(
'支持HTTP和HTTPS,模板变量: {{title}} (通知标题), {{content}} (通知内容)',
{ title: '{{title}}', content: '{{content}}' },
)}
showClear
rules={[
@@ -569,14 +576,18 @@ const NotificationSettings = ({
</div>
<div className='text-xs text-gray-600 font-mono bg-white p-3 rounded-lg shadow-sm mb-4'>
https://api.day.app/yourkey/{'{{title}}'}/
{'{{content}}'}?sound=alarm&group=quota
{'{{content}}'}
{I18N_TECHNICAL_TEXT.SOUND_ALARM_GROUP_QUOTA}
</div>
<div className='text-xs text-gray-500 space-y-2'>
<div>
• <strong>{'title'}:</strong> {t('通知标题')}
• <strong>{I18N_TECHNICAL_TEXT.TITLE_LABEL}:</strong>{' '}
{t('通知标题')}
</div>
<div>
• <strong>{'content'}:</strong> {t('通知内容')}
•{' '}
<strong>{I18N_TECHNICAL_TEXT.CONTENT_LABEL}:</strong>{' '}
{t('通知内容')}
</div>
<div className='mt-3 pt-3 border-t border-gray-200'>
<span className='text-gray-400'>
@@ -588,7 +599,7 @@ const NotificationSettings = ({
rel='noopener noreferrer'
className='text-blue-500 hover:text-blue-600 font-medium'
>
Bark {t('官方文档')}
{I18N_TECHNICAL_TEXT.BARK} {t('官方文档')}
</a>
</div>
</div>
@@ -689,7 +700,7 @@ const NotificationSettings = ({
rel='noopener noreferrer'
className='text-blue-500 hover:text-blue-600 font-medium'
>
Gotify {t('官方文档')}
{I18N_TECHNICAL_TEXT.GOTIFY} {t('官方文档')}
</a>
</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 { Trans } from 'react-i18next';
import { useEffectEvent } from '../../../../hooks/common/useEffectEvent';
import { writeClipboardText } from '../../../../helpers/clipboard';
import { API, showError, showSuccess, showWarning } from '../../../../helpers';
@@ -406,9 +407,11 @@ const TwoFASetting = ({ t }) => {
{status.enabled && (
<div className='mt-2'>
<Text size='small' type='secondary'>
{t('剩余备用码:')}
{status.backup_codes_remaining || 0}
{t('个')}
<Trans
t={t}
i18nKey='剩余备用码:{{value}}个'
values={{ value: status.backup_codes_remaining || 0 }}
/>
</Text>
</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 React from 'react';
import { Banner } from '@/components/ui';
@@ -55,7 +56,8 @@ const DatabaseStep = ({ setupStatus, renderNavigationButtons, t }) => {
</p>
)}
<p className='mt-2 text-sm opacity-70'>
💡 {t('提示:如需备份数据,只需复制上述目录即可')}
{I18N_TECHNICAL_TEXT.TIP_ICON}{' '}
{t('提示:如需备份数据,只需复制上述目录即可')}
</p>
</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 React, { useEffect, useRef, useState } from 'react';
import { Modal, Form, Typography, Banner, Spin, Tag } from '@/components/ui';
import { API, showError, renderQuotaWithPrompt } from '../../../../helpers';
@@ -148,19 +149,26 @@ const AdminEditTokenModal = ({
type='info'
description={
<span>
{t('正在以管理员身份编辑')}{' '}
<Text strong>
{token.display_name || token.username || '—'}
</Text>{' '}
(ID: {token.user_id}) {t('的密钥')}
<Tag
color={curStatusMeta.color}
shape='circle'
size='small'
className='!ml-2'
>
{t(curStatusMeta.label)}
</Tag>
<Trans
t={t}
i18nKey='正在以管理员身份编辑 <part0>{{value}}</part0> (ID:{{user_id}}) 的密钥<part1>{{label}}</part1>'
values={{
value: token.display_name || token.username || '—',
user_id: token.user_id,
label: t(curStatusMeta.label),
}}
components={{
part0: <Text strong />,
part1: (
<Tag
color={curStatusMeta.color}
shape='circle'
size='small'
className='!ml-2'
/>
),
}}
/>
</span>
}
closeIcon={null}
@@ -336,7 +336,9 @@ const renderDailyQuota = (record, dailyQuotaInfo, t) => {
// 没有消耗数据时显示限额
return (
<Tooltip content={t('日限额') + ': ' + formatQuotaCount(limit)}>
<Tooltip
content={t('日限额: {{value}}', { value: formatQuotaCount(limit) })}
>
<Tag color='blue' shape='circle'>
{formatQuotaCount(limit)}
</Tag>
@@ -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 '../../../console/module-alignment.css';
import React, { useEffect, useState, useRef, useMemo } from 'react';
@@ -2837,12 +2838,12 @@ const EditChannelModal = (props) => {
key={`model_mapping-${isEdit ? channelId : 'new'}`}
field='model_mapping'
label={t('模型重定向')}
placeholder={
t(
'此项可选,用于修改请求体中的模型名称,为一个 JSON 字符串,键为请求中模型名称,值为要替换的模型名称,例如:',
) +
`\n${JSON.stringify(MODEL_MAPPING_EXAMPLE, null, 2)}`
}
placeholder={t(
'此项可选,用于修改请求体中的模型名称,为一个 JSON 字符串,键为请求中模型名称,值为要替换的模型名称,例如:{{value}}',
{
value: `\n${JSON.stringify(MODEL_MAPPING_EXAMPLE, null, 2)}`,
},
)}
value={inputs.model_mapping || ''}
onChange={(value) =>
handleInputChange('model_mapping', value)
@@ -3173,17 +3174,9 @@ const EditChannelModal = (props) => {
<Form.TextArea
field='param_override'
label={t('参数覆盖')}
placeholder={
t(
'此项可选,用于覆盖请求参数。不支持覆盖 stream 参数',
) +
'\n' +
t('旧格式(直接覆盖):') +
'\n{\n "temperature": 0,\n "max_tokens": 1000\n}' +
'\n\n' +
t('新格式(支持条件判断与json自定义):') +
'\n{\n "operations": [\n {\n "path": "temperature",\n "mode": "set",\n "value": 0.7,\n "conditions": [\n {\n "path": "model",\n "mode": "prefix",\n "value": "gpt"\n }\n ]\n }\n ]\n}'
}
placeholder={t(
'此项可选,用于覆盖请求参数。不支持覆盖 stream 参数\n旧格式(直接覆盖):\n{\n "temperature": 0,\n "max_tokens": 1000\n}\n\n新格式(支持条件判断与json自定义):\n{\n "operations": [\n {\n "path": "temperature",\n "mode": "set",\n "value": 0.7,\n "conditions": [\n {\n "path": "model",\n "mode": "prefix",\n "value": "gpt"\n }\n ]\n }\n ]\n}',
)}
autosize
onChange={(value) =>
handleInputChange('param_override', value)
@@ -3240,12 +3233,9 @@ const EditChannelModal = (props) => {
<Form.TextArea
field='header_override'
label={t('请求头覆盖')}
placeholder={
t('此项可选,用于覆盖请求头参数') +
'\n' +
t('格式示例:') +
'\n{\n "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0",\n "Authorization": "Bearer {api_key}"\n}'
}
placeholder={t(
'此项可选,用于覆盖请求头参数\n格式示例:\n{\n "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0",\n "Authorization": "Bearer {api_key}"\n}',
)}
autosize
onChange={(value) =>
handleInputChange('header_override', value)
@@ -3279,7 +3269,8 @@ const EditChannelModal = (props) => {
</Text>
<div className='text-xs text-tertiary ml-2'>
<div>
{t('渠道密钥')}: {'{api_key}'}
{t('渠道密钥')}:{' '}
{I18N_TECHNICAL_TEXT.API_KEY_PLACEHOLDER}
</div>
</div>
</div>
@@ -3292,13 +3283,16 @@ const EditChannelModal = (props) => {
key={`status_code_mapping-${isEdit ? channelId : 'new'}`}
field='status_code_mapping'
label={t('状态码复写')}
placeholder={
t(
'此项可选,用于复写返回的状态码,仅影响本地判断,不修改返回到上游的状态码,比如将claude渠道的400错误复写为500(用于重试),请勿滥用该功能,例如:',
) +
'\n' +
JSON.stringify(STATUS_CODE_MAPPING_EXAMPLE, null, 2)
}
placeholder={t(
'此项可选,用于复写返回的状态码,仅影响本地判断,不修改返回到上游的状态码,比如将claude渠道的400错误复写为500(用于重试),请勿滥用该功能,例如:\n{{value}}',
{
value: JSON.stringify(
STATUS_CODE_MAPPING_EXAMPLE,
null,
2,
),
},
)}
value={inputs.status_code_mapping || ''}
onChange={(value) =>
handleInputChange('status_code_mapping', value)
@@ -3562,16 +3556,17 @@ const EditChannelModal = (props) => {
}
if (invalids.length > 0) {
showError(
t('绑定用户 ID 格式错误,以下不是有效的正整数') +
': ' +
invalids.join(', '),
t(
'绑定用户 ID 格式错误,以下不是有效的正整数: {{value}}',
{ value: invalids.join(', ') },
),
);
}
if (duplicates.length > 0) {
showInfo(
t('绑定用户 ID 存在重复') +
': ' +
duplicates.join(', '),
t('绑定用户 ID 存在重复: {{value}}', {
value: duplicates.join(', '),
}),
);
}
}}
@@ -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 {
@@ -554,15 +555,9 @@ const EditTagModal = (props) => {
<Form.TextArea
field='param_override'
label={t('参数覆盖')}
placeholder={
t('此项可选,用于覆盖请求参数。不支持覆盖 stream 参数') +
'\n' +
t('旧格式(直接覆盖):') +
'\n{\n "temperature": 0,\n "max_tokens": 1000\n}' +
'\n\n' +
t('新格式(支持条件判断与json自定义):') +
'\n{\n "operations": [\n {\n "path": "temperature",\n "mode": "set",\n "value": 0.7,\n "conditions": [\n {\n "path": "model",\n "mode": "prefix",\n "value": "gpt"\n }\n ]\n }\n ]\n}'
}
placeholder={t(
'此项可选,用于覆盖请求参数。不支持覆盖 stream 参数\n旧格式(直接覆盖):\n{\n "temperature": 0,\n "max_tokens": 1000\n}\n\n新格式(支持条件判断与json自定义):\n{\n "operations": [\n {\n "path": "temperature",\n "mode": "set",\n "value": 0.7,\n "conditions": [\n {\n "path": "model",\n "mode": "prefix",\n "value": "gpt"\n }\n ]\n }\n ]\n}',
)}
autosize
showClear
onChange={(value) =>
@@ -627,12 +622,9 @@ const EditTagModal = (props) => {
<Form.TextArea
field='header_override'
label={t('请求头覆盖')}
placeholder={
t('此项可选,用于覆盖请求头参数') +
'\n' +
t('格式示例:') +
'\n{\n "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0",\n "Authorization": "Bearer {api_key}"\n}'
}
placeholder={t(
'此项可选,用于覆盖请求头参数\n格式示例:\n{\n "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0",\n "Authorization": "Bearer {api_key}"\n}',
)}
autosize
showClear
onChange={(value) =>
@@ -675,7 +667,8 @@ const EditTagModal = (props) => {
</Text>
<div className='text-xs text-tertiary ml-2'>
<div>
{t('渠道密钥')}: {'{api_key}'}
{t('渠道密钥')}:{' '}
{I18N_TECHNICAL_TEXT.API_KEY_PLACEHOLDER}
</div>
</div>
</div>
@@ -68,7 +68,7 @@ const ModelTestModal = ({
{ value: 'jina-rerank', label: 'Jina Rerank (/rerank)' },
{
value: 'image-generation',
label: t('图像生成') + ' (/v1/images/generations)',
label: t('图像生成 (/v1/images/generations)'),
},
{ value: 'embeddings', label: 'Embeddings (/v1/embeddings)' },
];
@@ -29,7 +29,9 @@ const ModelBasicInfo = ({ modelData, t }) => {
if (!modelData) return t('暂无模型描述');
if (modelData.description) return modelData.description;
if (modelData.vendor_description)
return t('供应商信息:') + modelData.vendor_description;
return t('供应商信息:{{vendor_description}}', {
vendor_description: modelData.vendor_description,
});
return t('暂无模型描述');
};
@@ -60,7 +60,7 @@ const BatchCategoryModal = ({
showError(message || t('加载分类失败'));
}
} catch (error) {
showError(t('加载分类失败: ') + error.message);
showError(t('加载分类失败: {{message}}', { message: error.message }));
} finally {
setCategoriesLoading(false);
}
@@ -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 } from 'react';
import {
@@ -124,7 +125,11 @@ const MissingModelsModal = ({ visible, onClose, onConfigureModel, t }) => {
{t('未配置的模型列表')}
</Typography.Text>
<Typography.Text type='tertiary' size='small'>
{t('共')} {missingModels.length} {t('个未配置模型')}
<Trans
t={t}
i18nKey='共 {{length}} 个未配置模型'
values={{ length: missingModels.length }}
/>
</Typography.Text>
</div>
</div>
@@ -108,7 +108,7 @@ const renderGroupColumn = (text, t) => {
};
// Render token key column with show/hide and copy functionality
const renderTokenKey = (text, record, showKeys, setShowKeys, copyText) => {
const renderTokenKey = (text, record, showKeys, setShowKeys, copyText, t) => {
const fullKey = 'sk-' + record.key;
const maskedKey =
'sk-' + record.key.slice(0, 4) + '**********' + record.key.slice(-4);
@@ -127,7 +127,7 @@ const renderTokenKey = (text, record, showKeys, setShowKeys, copyText) => {
size='small'
type='tertiary'
icon={revealed ? <IconEyeClosed /> : <IconEyeOpened />}
aria-label='toggle token visibility'
aria-label={t('切换密钥可见性')}
onClick={(e) => {
e.stopPropagation();
setShowKeys((prev) => ({ ...prev, [record.id]: !revealed }));
@@ -138,7 +138,7 @@ const renderTokenKey = (text, record, showKeys, setShowKeys, copyText) => {
size='small'
type='tertiary'
icon={<IconCopy />}
aria-label='copy token key'
aria-label={t('复制密钥')}
onClick={async (e) => {
e.stopPropagation();
await copyText(fullKey);
@@ -461,7 +461,7 @@ export const getTokensColumns = ({
title: t('密钥'),
key: 'token_key',
render: (text, record) =>
renderTokenKey(text, record, showKeys, setShowKeys, copyText),
renderTokenKey(text, record, showKeys, setShowKeys, copyText, t),
},
{
title: t('可用模型'),
@@ -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, { useState, useEffect } from 'react';
import { Modal, Table, Tag, Spin } from '@/components/ui';
@@ -140,8 +141,14 @@ const InvitedUsersModal = ({ visible, onCancel, user, t }) => {
<span>{t('邀请的用户')}</span>
{user && (
<span className='ml-2 text-gray-500 text-sm'>
{user.display_name || user.username} {t('邀请了')} {total}{' '}
{t('位用户')}
<Trans
t={t}
i18nKey='{{value}} 邀请了 {{total}} 位用户'
values={{
value: user.display_name || user.username,
total: total,
}}
/>
</span>
)}
</div>
+7 -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 { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import { Receipt as ActionReceipt } from '@/components/common/icons/ActionIcons';
import React, { useRef } from 'react';
import {
@@ -259,7 +260,9 @@ const RechargeCard = ({
return disabled &&
minTopupVal > Number(topUpCount || 0) ? (
<Tooltip
content={t('最低充值') + ' ' + minTopupVal}
content={t('最低充值 {{minTopupVal}}', {
minTopupVal: minTopupVal,
})}
key={payMethod.type}
>
{buttonEl}
@@ -296,7 +299,8 @@ const RechargeCard = ({
return (
<span className='text-xs font-normal px-2 py-0.5 bg-gray-100 dark:bg-gray-700 rounded-full text-gray-500'>
1 $ ≈ {rate.toFixed(2)} {symbol}
{I18N_TECHNICAL_TEXT.USD_EXCHANGE_PREFIX}{' '}
{rate.toFixed(2)} {symbol}
</span>
);
})()}
@@ -415,7 +419,7 @@ const RechargeCard = ({
<Form.Slot
label={
<span className='text-base font-semibold text-gray-700 dark:text-gray-200'>
Creem {t('套餐')}
{I18N_TECHNICAL_TEXT.CREEM} {t('套餐')}
</span>
}
>
+2 -2
View File
@@ -113,7 +113,7 @@ const TopUp = () => {
showSuccess(t('兑换成功!'));
Modal.success({
title: t('兑换成功!'),
content: t('成功兑换额度:') + renderQuota(data),
content: t('成功兑换额度:{{value}}', { value: renderQuota(data) }),
centered: true,
});
if (userState.user) {
@@ -505,7 +505,7 @@ const TopUp = () => {
}, [statusState?.status]);
const renderAmount = () => {
return amount + ' ' + t('元');
return t('{{value}}元', { value: amount + ' ' });
};
const getAmount = async (value) => {
@@ -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 './payment-confirm.css';
import React, { useEffect, useState } from 'react';
import { Tag as AntTag } from 'antd';
@@ -150,7 +152,8 @@ const PaymentConfirmModal = ({
<div>
<dt>{t('优惠减免')}</dt>
<dd className='payment-confirm-discount'>
- ¥{discountAmount.toFixed(2)}
{I18N_TECHNICAL_TEXT.CNY_DEDUCTION_PREFIX}
{discountAmount.toFixed(2)}
</dd>
</div>
</>
@@ -182,8 +185,15 @@ const PaymentConfirmModal = ({
</div>
<div>
<dt>
{t('汇率来源')}:{t(payPalQuote.exchangeRateSource)}
<br />1 USD = {payPalQuote.exchangeRate} CNY
<Trans
t={t}
i18nKey='汇率来源:{{label}}<part0/>1 USD ={{exchangeRate}}CNY'
values={{
label: t(payPalQuote.exchangeRateSource),
exchangeRate: payPalQuote.exchangeRate,
}}
components={{ part0: <br /> }}
/>
</dt>
<dd className='payment-confirm-method'>
<Clock3 size={14} />
@@ -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 from 'react';
import { Modal, Typography, Input } from '@/components/ui';
import { CreditCard } from 'lucide-react';
@@ -60,7 +61,11 @@ const TransferModal = ({
</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()}