diff --git a/web/src/components/auth/OAuth2Callback.js b/web/src/components/auth/OAuth2Callback.js index 83f9db46..6d0bbe70 100644 --- a/web/src/components/auth/OAuth2Callback.js +++ b/web/src/components/auth/OAuth2Callback.js @@ -1,15 +1,16 @@ import React, { useContext, useEffect, useState } from 'react'; -import { Spin, Typography, Space } from '@douyinfe/semi-ui'; import { useNavigate, useSearchParams } from 'react-router-dom'; +import { useTranslation } from 'react-i18next'; import { API, showError, showSuccess, updateAPI, setUserData } from '../../helpers'; import { UserContext } from '../../context/User'; +import Loading from '../common/Loading'; const OAuth2Callback = (props) => { + const { t } = useTranslation(); const [searchParams, setSearchParams] = useSearchParams(); const [userState, userDispatch] = useContext(UserContext); - const [prompt, setPrompt] = useState('处理中...'); - const [processing, setProcessing] = useState(true); + const [prompt, setPrompt] = useState(t('处理中...')); let navigate = useNavigate(); @@ -20,25 +21,25 @@ const OAuth2Callback = (props) => { const { success, message, data } = res.data; if (success) { if (message === 'bind') { - showSuccess('绑定成功!'); - navigate('/setting'); + showSuccess(t('绑定成功!')); + navigate('/console/setting'); } else { userDispatch({ type: 'login', payload: data }); localStorage.setItem('user', JSON.stringify(data)); setUserData(data); updateAPI(); - showSuccess('登录成功!'); - navigate('/token'); + showSuccess(t('登录成功!')); + navigate('/console/token'); } } else { showError(message); if (count === 0) { - setPrompt(`操作失败,重定向至登录界面中...`); - navigate('/setting'); // in case this is failed to bind GitHub + setPrompt(t('操作失败,重定向至登录界面中...')); + navigate('/console/setting'); // in case this is failed to bind GitHub return; } count++; - setPrompt(`出现错误,第 ${count} 次重试中...`); + setPrompt(t('出现错误,第 ${count} 次重试中...', { count })); await new Promise((resolve) => setTimeout(resolve, count * 2000)); await sendCode(code, state, count); } @@ -50,17 +51,7 @@ const OAuth2Callback = (props) => { sendCode(code, state, 0).then(); }, []); - return ( -
- - -
- {prompt} -
-
-
-
- ); + return ; }; export default OAuth2Callback; diff --git a/web/src/components/layout/Footer.js b/web/src/components/layout/Footer.js index d53ae2ed..4f44c1dc 100644 --- a/web/src/components/layout/Footer.js +++ b/web/src/components/layout/Footer.js @@ -40,36 +40,36 @@ const FooterBar = () => {

{t('关于我们')}

- {t('关于项目')} - {t('联系我们')} - {t('功能特性')} + {t('关于项目')} + {t('联系我们')} + {t('功能特性')}

{t('文档')}

- {t('快速开始')} - {t('安装指南')} - {t('API 文档')} + {t('快速开始')} + {t('安装指南')} + {t('API 文档')}

{t('相关项目')}

- One API - Midjourney-Proxy - chatnio - neko-api-key-tool + One API + Midjourney-Proxy + chatnio + neko-api-key-tool

{t('基于New API的项目')}

- new-api-horizon - {/* VoAPI */} + new-api-horizon + {/* VoAPI */}
@@ -81,14 +81,12 @@ const FooterBar = () => { © {currentYear} {systemName}. {t('版权所有')} - {isDemoSiteMode && ( -
- {t('设计与开发由')} - Douyin FE - & - QuantumNous -
- )} +
+ {t('设计与开发由')} + New API + & + One API +
), [logo, systemName, t, currentYear, isDemoSiteMode]); diff --git a/web/src/i18n/locales/en.json b/web/src/i18n/locales/en.json index 29469d14..a3a05acd 100644 --- a/web/src/i18n/locales/en.json +++ b/web/src/i18n/locales/en.json @@ -1404,8 +1404,13 @@ "演示站点": "Demo Site", "页面未找到,请检查您的浏览器地址是否正确": "Page not found, please check if your browser address is correct", "New API项目仓库地址:": "New API project repository address: ", - "NewAPI © {{currentYear}} QuantumNous | 基于 One API v0.5.4 © 2023 JustSong。": "NewAPI © {{currentYear}} QuantumNous | Based on One API v0.5.4 © 2023 JustSong.", - "本项目根据MIT许可证授权,需在遵守Apache-2.0协议的前提下使用。": "This project is licensed under the MIT License and must be used in compliance with the Apache-2.0 License.", + "© {{currentYear}}": "© {{currentYear}}", + "| 基于": " | Based on ", + "MIT许可证": "MIT License", + "Apache-2.0协议": "Apache-2.0 License", + "本项目根据": "This project is licensed under the ", + "授权,需在遵守": " and must be used in compliance with the ", + "的前提下使用。": ".", "管理员暂时未设置任何关于内容": "The administrator has not set any custom About content yet", "早上好": "Good morning", "中午好": "Good afternoon", @@ -1531,6 +1536,7 @@ "关闭公告": "Close Notice", "搜索条件": "Search Conditions", "加载中...": "Loading...", + "正在跳转...": "Redirecting...", "暂无公告": "No Notice", "操练场": "Playground", "欢迎使用,请完成以下设置以开始使用系统": "Welcome to use, please complete the following settings to start using the system", diff --git a/web/src/pages/About/index.js b/web/src/pages/About/index.js index 42ac09e0..3259449e 100644 --- a/web/src/pages/About/index.js +++ b/web/src/pages/About/index.js @@ -3,7 +3,6 @@ import { API, showError } from '../../helpers'; import { marked } from 'marked'; import { Empty } from '@douyinfe/semi-ui'; import { IllustrationConstruction, IllustrationConstructionDark } from '@douyinfe/semi-illustrations'; -import { Link } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; const About = () => { @@ -42,14 +41,65 @@ const About = () => {

{t('可在设置页面设置关于内容,支持 HTML & Markdown')}

{t('New API项目仓库地址:')} - + https://github.com/QuantumNous/new-api - +

- {t('NewAPI © {{currentYear}} QuantumNous | 基于 One API v0.5.4 © 2023 JustSong。', { currentYear })} + + NewAPI + {t('© {{currentYear}}', { currentYear })} + QuantumNous + {t('| 基于')} + One API v0.5.4 + © 2023 + JustSong +

- {t('本项目根据MIT许可证授权,需在遵守Apache-2.0协议的前提下使用。')} + {t('本项目根据')} + + {t('MIT许可证')} + + {t('授权,需在遵守')} + + {t('Apache-2.0协议')} + + {t('的前提下使用。')}

); diff --git a/web/src/pages/Channel/EditChannel.js b/web/src/pages/Channel/EditChannel.js index feed8beb..04dc284b 100644 --- a/web/src/pages/Channel/EditChannel.js +++ b/web/src/pages/Channel/EditChannel.js @@ -846,7 +846,7 @@ const EditChannel = (props) => { className="!rounded-lg font-mono" /> handleInputChange('model_mapping', JSON.stringify(MODEL_MAPPING_EXAMPLE, null, 2))} > {t('填入模板')} @@ -940,7 +940,7 @@ const EditChannel = (props) => { className="!rounded-lg font-mono" /> handleInputChange('other', JSON.stringify(REGION_EXAMPLE, null, 2))} > {t('填入模板')} @@ -1062,7 +1062,7 @@ const EditChannel = (props) => { />
{ handleInputChange( 'setting', @@ -1073,10 +1073,10 @@ const EditChannel = (props) => { {t('填入模板')} { window.open( - 'https://github.com/Calcium-Ion/new-api/blob/main/docs/channel/other_setting.md', + 'https://github.com/QuantumNous/new-api/blob/main/docs/channel/other_setting.md', ); }} > @@ -1146,7 +1146,7 @@ const EditChannel = (props) => { className="!rounded-lg font-mono" /> { handleInputChange( 'status_code_mapping', diff --git a/web/src/pages/Chat/index.js b/web/src/pages/Chat/index.js index bd4e19a1..22c5c1e2 100644 --- a/web/src/pages/Chat/index.js +++ b/web/src/pages/Chat/index.js @@ -1,9 +1,11 @@ -import React, { useEffect } from 'react'; +import React from 'react'; import { useTokenKeys } from '../../hooks/useTokenKeys'; -import { Banner, Layout } from '@douyinfe/semi-ui'; +import { Spin } from '@douyinfe/semi-ui'; import { useParams } from 'react-router-dom'; +import { useTranslation } from 'react-i18next'; const ChatPage = () => { + const { t } = useTranslation(); const { id } = useParams(); const { keys, serverAddress, isLoading } = useTokenKeys(id); @@ -40,12 +42,17 @@ const ChatPage = () => { allow='camera;microphone' /> ) : ( -
- - - - - +
+
+ + + {t('正在跳转...')} + +
); };