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
+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'