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