mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-17 09:16:36 +08:00
feat: i18n support
This commit is contained in:
parent
6ca6a3ea74
commit
4a5f872dce
@ -81,10 +81,10 @@
|
|||||||
"hide_detail": "Hide Details"
|
"hide_detail": "Hide Details"
|
||||||
},
|
},
|
||||||
"messages": {
|
"messages": {
|
||||||
"test_success": "Channel ${name} test successful, model ${model}, time ${time}s, output: ${message}",
|
"test_success": "Channel {{name}} test successful, model {{model}}, time {{time}}s, output: {{message}}",
|
||||||
"test_all_started": "Channel testing started successfully, please refresh page to see results.",
|
"test_all_started": "Channel testing started successfully, please refresh page to see results.",
|
||||||
"delete_disabled_success": "Deleted all disabled channels, total: ${count}",
|
"delete_disabled_success": "Deleted all disabled channels, total: {{count}}",
|
||||||
"balance_update_success": "Channel ${name} balance updated successfully!",
|
"balance_update_success": "Channel {{name}} balance updated successfully!",
|
||||||
"all_balance_updated": "All enabled channel balances have been updated!"
|
"all_balance_updated": "All enabled channel balances have been updated!"
|
||||||
},
|
},
|
||||||
"edit": {
|
"edit": {
|
||||||
|
@ -81,10 +81,10 @@
|
|||||||
"hide_detail": "隐藏详情"
|
"hide_detail": "隐藏详情"
|
||||||
},
|
},
|
||||||
"messages": {
|
"messages": {
|
||||||
"test_success": "渠道 ${name} 测试成功,模型 ${model},耗时 ${time} 秒,模型输出:${message}",
|
"test_success": "渠道 {{name}} 测试成功,模型 {{model}},耗时 {{time}} 秒,模型输出:{{message}}",
|
||||||
"test_all_started": "已成功开始测试渠道,请刷新页面查看结果。",
|
"test_all_started": "已成功开始测试渠道,请刷新页面查看结果。",
|
||||||
"delete_disabled_success": "已删除所有禁用渠道,共计 ${count} 个",
|
"delete_disabled_success": "已删除所有禁用渠道,共计 {{count}} 个",
|
||||||
"balance_update_success": "渠道 ${name} 余额更新成功!",
|
"balance_update_success": "渠道 {{name}} 余额更新成功!",
|
||||||
"all_balance_updated": "已更新完毕所有已启用渠道余额!"
|
"all_balance_updated": "已更新完毕所有已启用渠道余额!"
|
||||||
},
|
},
|
||||||
"edit": {
|
"edit": {
|
||||||
|
@ -198,7 +198,7 @@ const ChannelsTable = () => {
|
|||||||
}
|
}
|
||||||
const { success, message } = res.data;
|
const { success, message } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
showSuccess('操作成功完成!');
|
showSuccess(t('channel.messages.operation_success'));
|
||||||
let channel = res.data.data;
|
let channel = res.data.data;
|
||||||
let newChannels = [...channels];
|
let newChannels = [...channels];
|
||||||
let realIdx = (activePage - 1) * ITEMS_PER_PAGE + idx;
|
let realIdx = (activePage - 1) * ITEMS_PER_PAGE + idx;
|
||||||
@ -325,14 +325,7 @@ const ChannelsTable = () => {
|
|||||||
newChannels[realIdx].response_time = time * 1000;
|
newChannels[realIdx].response_time = time * 1000;
|
||||||
newChannels[realIdx].test_time = Date.now() / 1000;
|
newChannels[realIdx].test_time = Date.now() / 1000;
|
||||||
setChannels(newChannels);
|
setChannels(newChannels);
|
||||||
showInfo(
|
showSuccess(t('channel.messages.test_success', { name, model, time, message }));
|
||||||
t('channel.messages.test_success', {
|
|
||||||
name: name,
|
|
||||||
model: model,
|
|
||||||
time: time.toFixed(2),
|
|
||||||
message: message,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
@ -357,9 +350,7 @@ const ChannelsTable = () => {
|
|||||||
const res = await API.delete(`/api/channel/disabled`);
|
const res = await API.delete(`/api/channel/disabled`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
showSuccess(
|
showSuccess(t('channel.messages.delete_disabled_success', { count: data }));
|
||||||
t('channel.messages.delete_disabled_success', { count: data })
|
|
||||||
);
|
|
||||||
await refresh();
|
await refresh();
|
||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
@ -375,7 +366,7 @@ const ChannelsTable = () => {
|
|||||||
newChannels[realIdx].balance = balance;
|
newChannels[realIdx].balance = balance;
|
||||||
newChannels[realIdx].balance_updated_time = Date.now() / 1000;
|
newChannels[realIdx].balance_updated_time = Date.now() / 1000;
|
||||||
setChannels(newChannels);
|
setChannels(newChannels);
|
||||||
showInfo(t('channel.messages.balance_update_success', { name: name }));
|
showSuccess(t('channel.messages.balance_update_success', { name }));
|
||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user