diff --git a/web/default/public/locales/en/translation.json b/web/default/public/locales/en/translation.json index f3b42731..0265b7b9 100644 --- a/web/default/public/locales/en/translation.json +++ b/web/default/public/locales/en/translation.json @@ -303,5 +303,40 @@ "amount": "Amount", "time": "Time" } + }, + "user": { + "edit": { + "title": "Update User Information", + "username": "Username", + "username_placeholder": "Please enter new username", + "password": "Password", + "password_placeholder": "Please enter new password, minimum 8 characters", + "display_name": "Display Name", + "display_name_placeholder": "Please enter new display name", + "group": "Group", + "group_placeholder": "Please select group", + "group_addition": "Please edit group multipliers in system settings to add new group:", + "quota": "Remaining Quota", + "quota_placeholder": "Please enter new remaining quota", + "github_id": "Linked GitHub Account", + "github_id_placeholder": "Read-only, user must link through personal settings page, cannot be modified directly", + "wechat_id": "Linked WeChat Account", + "wechat_id_placeholder": "Read-only, user must link through personal settings page, cannot be modified directly", + "email": "Linked Email Account", + "email_placeholder": "Read-only, user must link through personal settings page, cannot be modified directly", + "buttons": { + "submit": "Submit", + "cancel": "Cancel" + } + }, + "messages": { + "update_success": "User information updated successfully!" + }, + "add": { + "title": "Create New User Account" + }, + "messages": { + "create_success": "User account created successfully!" + } } } diff --git a/web/default/public/locales/zh/translation.json b/web/default/public/locales/zh/translation.json index 3245b8a2..ff1bdbb0 100644 --- a/web/default/public/locales/zh/translation.json +++ b/web/default/public/locales/zh/translation.json @@ -303,5 +303,40 @@ "amount": "数量", "time": "时间" } + }, + "user": { + "edit": { + "title": "更新用户信息", + "username": "用户名", + "username_placeholder": "请输入新的用户名", + "password": "密码", + "password_placeholder": "请输入新的密码,最短 8 位", + "display_name": "显示名称", + "display_name_placeholder": "请输入新的显示名称", + "group": "分组", + "group_placeholder": "请选择分组", + "group_addition": "请在系统设置页面编辑分组倍率以添加新的分组:", + "quota": "剩余额度", + "quota_placeholder": "请输入新的剩余额度", + "github_id": "已绑定的 GitHub 账户", + "github_id_placeholder": "此项只读,需要用户通过个人设置页面的相关绑定按钮进行绑定,不可直接修改", + "wechat_id": "已绑定的微信账户", + "wechat_id_placeholder": "此项只读,需要用户通过个人设置页面的相关绑定按钮进行绑定,不可直接修改", + "email": "已绑定的邮箱账户", + "email_placeholder": "此项只读,需要用户通过个人设置页面的相关绑定按钮进行绑定,不可直接修改", + "buttons": { + "submit": "提交", + "cancel": "取消" + } + }, + "messages": { + "update_success": "用户信息更新成功!" + }, + "add": { + "title": "创建新用户账户" + }, + "messages": { + "create_success": "用户账户创建成功!" + } } } diff --git a/web/default/src/pages/User/AddUser.js b/web/default/src/pages/User/AddUser.js index f9f4bc18..c261ab4c 100644 --- a/web/default/src/pages/User/AddUser.js +++ b/web/default/src/pages/User/AddUser.js @@ -1,8 +1,10 @@ import React, { useState } from 'react'; +import { useTranslation } from 'react-i18next'; import { Button, Form, Header, Segment } from 'semantic-ui-react'; import { API, showError, showSuccess } from '../../helpers'; const AddUser = () => { + const { t } = useTranslation(); const originInputs = { username: '', display_name: '', @@ -20,7 +22,7 @@ const AddUser = () => { const res = await API.post(`/api/user/`, inputs); const { success, message } = res.data; if (success) { - showSuccess('用户账户创建成功!'); + showSuccess(t('user.messages.create_success')); setInputs(originInputs); } else { showError(message); @@ -30,43 +32,43 @@ const AddUser = () => { return ( <> -
创建新用户账户
-
+
{t('user.add.title')}
+
diff --git a/web/default/src/pages/User/EditUser.js b/web/default/src/pages/User/EditUser.js index f256b68e..8b154230 100644 --- a/web/default/src/pages/User/EditUser.js +++ b/web/default/src/pages/User/EditUser.js @@ -1,10 +1,12 @@ import React, { useEffect, useState } from 'react'; +import { useTranslation } from 'react-i18next'; import { Button, Form, Card } from 'semantic-ui-react'; import { useParams, useNavigate } from 'react-router-dom'; import { API, showError, showSuccess } from '../../helpers'; import { renderQuota, renderQuotaWithPrompt } from '../../helpers/render'; const EditUser = () => { + const { t } = useTranslation(); const params = useParams(); const userId = params.id; const [loading, setLoading] = useState(true); @@ -86,7 +88,7 @@ const EditUser = () => { } const { success, message } = res.data; if (success) { - showSuccess('用户信息更新成功!'); + showSuccess(t('user.messages.update_success')); } else { showError(message); } @@ -96,13 +98,13 @@ const EditUser = () => {
- 更新用户信息 + {t('user.edit.title')}
{ { { <> { { )} - +