fix(i18n): 补齐九种语言的翻译并修复国际化检查
补齐页面缺译,统一动态文案的整句插值方式。
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user