fix(i18n): 补齐九语翻译并修复国际化检查
补齐历史缺译并统一整句插值。九语覆盖 100%,静态检查及 713 项单测通过。
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 { 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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,必须给横向滚动
|
||||
|
||||
@@ -214,7 +214,7 @@ const OperationSetting = () => {
|
||||
const errorBanner = loadError && (
|
||||
<Banner type='danger' closeIcon={null} description={loadError}>
|
||||
<Button onClick={onRefresh} disabled={loading}>
|
||||
重新加载运营设置
|
||||
{t('重新加载运营设置')}
|
||||
</Button>
|
||||
</Banner>
|
||||
);
|
||||
|
||||
@@ -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={
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user