From b20a030c6c2b071c19378594a2dbbcabb5bfea5c Mon Sep 17 00:00:00 2001 From: "huanyueyaoqin@qq.com" Date: Sun, 27 Aug 2023 10:26:10 +0800 Subject: [PATCH] feat: Team page add i18n --- .../src/components/ConnectionEdit/index.tsx | 2 +- chat2db-client/src/i18n/en-us/common.ts | 6 ++- chat2db-client/src/i18n/en-us/index.ts | 4 +- chat2db-client/src/i18n/en-us/team.ts | 39 +++++++++++++++++ chat2db-client/src/i18n/zh-cn/common.ts | 6 ++- chat2db-client/src/i18n/zh-cn/index.ts | 4 +- chat2db-client/src/i18n/zh-cn/team.ts | 39 +++++++++++++++++ .../main/team/datasource-management/index.tsx | 26 ++++++------ chat2db-client/src/pages/main/team/index.tsx | 9 ++-- .../pages/main/team/team-management/index.tsx | 34 +++++++-------- .../pages/main/team/user-management/index.tsx | 42 +++++++++---------- 11 files changed, 151 insertions(+), 60 deletions(-) create mode 100644 chat2db-client/src/i18n/en-us/team.ts create mode 100644 chat2db-client/src/i18n/zh-cn/team.ts diff --git a/chat2db-client/src/components/ConnectionEdit/index.tsx b/chat2db-client/src/components/ConnectionEdit/index.tsx index ebf85875..230b16fe 100644 --- a/chat2db-client/src/components/ConnectionEdit/index.tsx +++ b/chat2db-client/src/components/ConnectionEdit/index.tsx @@ -299,7 +299,7 @@ export default forwardRef(function CreateConnection(props: IProps, ref: Forwarde loading={loadings.confirmButton} onClick={saveConnection.bind(null, backfillData.id ? submitType.UPDATE : submitType.SAVE)} > - {backfillData.id ? i18n('common.button.edit') : i18n('common.button.save')} + {backfillData.id ? i18n('common.button.modify') : i18n('common.button.save')} diff --git a/chat2db-client/src/i18n/en-us/common.ts b/chat2db-client/src/i18n/en-us/common.ts index 8812789a..fd947679 100644 --- a/chat2db-client/src/i18n/en-us/common.ts +++ b/chat2db-client/src/i18n/en-us/common.ts @@ -3,6 +3,7 @@ export default { 'common.text.is': 'no', 'common.button.affirm': 'Affirm', 'common.button.edit': 'Edit', + 'common.button.modify': 'Modify', 'common.button.confirm': 'Confirm', 'common.button.cancel': 'Cancel', 'common.data.hour': '{1} {hour|hours}', @@ -75,5 +76,8 @@ export default { 'common.text.editorRightClick': 'Editor right click', 'common.form.error.required': 'This field is required!', 'common.form.error.email': 'The input is not a valid email!', - 'common.tips.delete.confirm': 'Are you sure to delete it?' + 'common.tips.delete.confirm': 'Are you sure to delete it?', + 'common.tips.updateSuccess': 'Update Successfully', + 'common.tips.createSuccess': 'Create Successfully', + 'common.text.action': 'Action' }; diff --git a/chat2db-client/src/i18n/en-us/index.ts b/chat2db-client/src/i18n/en-us/index.ts index 256cc7a9..deacf628 100644 --- a/chat2db-client/src/i18n/en-us/index.ts +++ b/chat2db-client/src/i18n/en-us/index.ts @@ -5,6 +5,7 @@ import setting from './setting'; import workspace from './workspace'; import dashboard from './dashboard'; import chat from './chat'; +import team from './team' export default { lang: 'en', @@ -14,5 +15,6 @@ export default { ...workspace, ...menu, ...dashboard, - ...chat + ...chat, + ...team }; diff --git a/chat2db-client/src/i18n/en-us/team.ts b/chat2db-client/src/i18n/en-us/team.ts new file mode 100644 index 00000000..d0e7906d --- /dev/null +++ b/chat2db-client/src/i18n/en-us/team.ts @@ -0,0 +1,39 @@ +export default { + 'team.tab.datasource': 'DataSource Management', + 'team.tab.user': 'User Management', + 'team.tab.team': 'Team Management', + 'team.datasource.alias': 'DataSource Name', + 'team.datasource.url': 'DataSource URL', + 'team.user.userName': 'UserName', + 'team.user.nickName': 'NickName', + 'team.user.status': 'Status', + 'team.action.rightManagement': 'Right Management', + 'team.action.editDatasource': 'Edit DataSource', + 'team.action.addDatasource': 'Add DataSource', + 'team.action.addUser': 'Add User', + 'team.action.editTeam': 'Edit Team', + 'team.action.addTeam': 'Add Team', + 'team.action.affiliation.user': 'Affiliation User', + 'team.action.affiliation.team': 'Affiliation Team', + 'team.action.affiliation.datasource': 'Affiliation DataSource', + 'team.input.search.placeholder': 'Please enter keywords to search', + + 'team.user.addForm.userName': 'UserName', + 'team.user.addForm.nickName': 'NickName', + 'team.user.addForm.email': 'Email', + 'team.user.addForm.password': 'Password', + 'team.user.addForm.roleCode': 'Role', + 'team.user.addForm.roleCode.admin': 'Admin', + 'team.user.addForm.roleCode.user': 'User', + 'team.user.addForm.status': 'Status', + 'team.user.addForm.status.valid': 'Valid', + 'team.user.addForm.status.invalid': 'Invalid', + + + 'team.team.addForm.code': 'Team Code', + 'team.team.addForm.name': 'Team Name', + 'team.team.addForm.status': 'Status', + 'team.team.addForm.status.valid': 'Valid', + 'team.team.addForm.status.invalid': 'Invalid', + 'team.team.addForm.description': 'Description', +} \ No newline at end of file diff --git a/chat2db-client/src/i18n/zh-cn/common.ts b/chat2db-client/src/i18n/zh-cn/common.ts index 6beb8eec..4b1956b2 100644 --- a/chat2db-client/src/i18n/zh-cn/common.ts +++ b/chat2db-client/src/i18n/zh-cn/common.ts @@ -3,6 +3,7 @@ export default { 'common.text.is': '是', 'common.button.affirm': '确认', 'common.button.edit': '编辑', + 'common.button.modify': '修改', 'common.button.confirm': '确认', 'common.button.cancel': '取消', 'common.data.hour': '{1}小时', @@ -73,5 +74,8 @@ export default { 'common.text.editorRightClick': '编辑器右键', 'common.form.error.required': '此项必填!', 'common.form.error.email': '不是正确的邮箱格式', - 'common.tips.delete.confirm': '确认要删除吗?' + 'common.tips.delete.confirm': '确认要删除吗?', + 'common.tips.updateSuccess': '更新成功', + 'common.tips.createSuccess': '创建成功', + 'common.text.action': '操作' }; diff --git a/chat2db-client/src/i18n/zh-cn/index.ts b/chat2db-client/src/i18n/zh-cn/index.ts index 867621af..4f46261f 100644 --- a/chat2db-client/src/i18n/zh-cn/index.ts +++ b/chat2db-client/src/i18n/zh-cn/index.ts @@ -6,6 +6,7 @@ import setting from './setting'; import workspace from './workspace'; import dashboard from './dashboard'; import chat from './chat'; +import team from './team' export default { lang: LangType.ZH_CN, @@ -16,5 +17,6 @@ export default { ...menu, ...connection, ...dashboard, - ...chat + ...chat, + ...team }; diff --git a/chat2db-client/src/i18n/zh-cn/team.ts b/chat2db-client/src/i18n/zh-cn/team.ts new file mode 100644 index 00000000..e15f1b41 --- /dev/null +++ b/chat2db-client/src/i18n/zh-cn/team.ts @@ -0,0 +1,39 @@ +export default { + 'team.tab.datasource': '链接管理', + 'team.tab.user': '用户管理', + 'team.tab.team': '团队管理', + 'team.datasource.alias': '链接名称', + 'team.datasource.url': '链接地址', + 'team.user.userName': '用户名', + 'team.user.nickName': '昵称', + 'team.user.status': '状态', + 'team.action.rightManagement': '权限管理', + 'team.action.editDatasource': '编辑链接', + 'team.action.addDatasource': '添加链接', + 'team.action.editUser': '编辑用户', + 'team.action.addUser': '添加用户', + 'team.action.editTeam': '编辑团队', + 'team.action.addTeam': '添加团队', + 'team.action.affiliation.user': '包含用户', + 'team.action.affiliation.team': '所属团队', + 'team.action.affiliation.datasource': '归属链接', + 'team.input.search.placeholder': '输入关键字进行搜索', + + 'team.user.addForm.userName': '用户名', + 'team.user.addForm.nickName': '昵称', + 'team.user.addForm.email': '邮箱', + 'team.user.addForm.password': '密码', + 'team.user.addForm.roleCode': '角色', + 'team.user.addForm.roleCode.admin': '管理员', + 'team.user.addForm.roleCode.user': '用户', + 'team.user.addForm.status': '状态', + 'team.user.addForm.status.valid': '有效', + 'team.user.addForm.status.invalid': '无效', + + 'team.team.addForm.code': '团队编码', + 'team.team.addForm.name': '团队名', + 'team.team.addForm.status': '状态', + 'team.team.addForm.status.valid': '有效', + 'team.team.addForm.status.invalid': '无效', + 'team.team.addForm.description': '描述', +} \ No newline at end of file diff --git a/chat2db-client/src/pages/main/team/datasource-management/index.tsx b/chat2db-client/src/pages/main/team/datasource-management/index.tsx index ab5eb15e..dec11728 100644 --- a/chat2db-client/src/pages/main/team/datasource-management/index.tsx +++ b/chat2db-client/src/pages/main/team/datasource-management/index.tsx @@ -9,8 +9,8 @@ import i18n from '@/i18n'; import { isValid } from '@/utils/check'; import CreateConnection from '@/blocks/CreateConnection'; import UniversalDrawer from '../universal-drawer'; -import styles from './index.less'; import { isNumber } from 'lodash'; +import styles from './index.less'; function DataSourceManagement() { const [dataSource, setDataSource] = useState([]); @@ -34,19 +34,19 @@ function DataSourceManagement() { const columns = useMemo( () => [ { - title: '链接名称', + title: i18n('team.datasource.alias'), dataIndex: 'alias', key: 'alias', }, { - title: '链接地址', + title: i18n('team.datasource.url'), dataIndex: 'url', key: 'url', }, { - title: '操作', + title: i18n('common.text.action'), key: 'action', - width: 180, + width: 300, render: (_: any, record: IDataSourceVO) => ( <> { if (isNumber(id)) { await deleteDataSource({ id }) - message.success('删除成功'); + message.success(i18n('common.text.successfullyDelete')); queryDataSourceList(); } }; @@ -141,7 +141,7 @@ function DataSourceManagement() { const requestApi = isUpdate ? updateDataSource : createDataSource; try { await requestApi({ ...connectionInfo.current }) - message.success(isUpdate ? '更新成功' : '创建成功') + message.success(isUpdate ? i18n('common.tips.updateSuccess') : i18n('common.tips.createSuccess')) setShowCreateConnection(false) queryDataSourceList() } catch { @@ -153,13 +153,13 @@ function DataSourceManagement() {
} />
setShowCreateConnection(false)} @@ -189,7 +189,7 @@ function DataSourceManagement() { }) }} /> - + ); } diff --git a/chat2db-client/src/pages/main/team/index.tsx b/chat2db-client/src/pages/main/team/index.tsx index 12f611a9..84b94d17 100644 --- a/chat2db-client/src/pages/main/team/index.tsx +++ b/chat2db-client/src/pages/main/team/index.tsx @@ -1,27 +1,28 @@ import React, { useMemo, useState } from 'react'; import { ApiOutlined, UserOutlined, TeamOutlined } from '@ant-design/icons'; import { Tabs } from 'antd'; -import styles from './index.less'; import DataSourceManagement from './datasource-management'; import UserManagement from './user-management'; import TeamManagement from './team-management'; +import i18n from '@/i18n'; +import styles from './index.less'; const Team = () => { const [activeKey, setActiveKey] = useState('0'); const tabList = useMemo( () => [ { - label: '共享链接管理', + label: i18n('team.tab.datasource'), icon: , children: , }, { - label: '用户管理', + label: i18n('team.tab.user'), icon: , children: , }, { - label: '团队管理', + label: i18n('team.tab.team'), icon: , children: , }, diff --git a/chat2db-client/src/pages/main/team/team-management/index.tsx b/chat2db-client/src/pages/main/team/team-management/index.tsx index 7d429bcb..b8ad6b29 100644 --- a/chat2db-client/src/pages/main/team/team-management/index.tsx +++ b/chat2db-client/src/pages/main/team/team-management/index.tsx @@ -35,23 +35,23 @@ function TeamManagement() { const columns = useMemo( () => [ { - title: '团队编码', + title: i18n('team.team.addForm.code'), dataIndex: 'code', key: 'code', }, { - title: '团队名', + title: i18n('team.team.addForm.name'), dataIndex: 'name', key: 'name', }, { - title: '状态', + title: i18n('team.team.addForm.status'), dataIndex: 'status', key: 'status', render: (status: StatusType) => {status}, }, { - title: '操作', + title: i18n('common.text.action'), key: 'action', width: 260, render: (_: any, record: ITeamVO) => ( @@ -70,7 +70,7 @@ function TeamManagement() { }); }} > - 包含用户 + {i18n('team.action.affiliation.user')} { if (id !== undefined) { await deleteTeam({ id }); - message.success('删除成功'); + message.success(i18n('common.text.successfullyDelete')); queryTeamList(); } }; @@ -159,13 +159,13 @@ function TeamManagement() {
} />
{ form @@ -207,19 +207,19 @@ function TeamManagement() { status: StatusType.VALID, }} > - + - + - + - 有效 - 无效 + {i18n('team.team.addForm.status.valid')} + {i18n('team.team.addForm.status.invalid')} - + diff --git a/chat2db-client/src/pages/main/team/user-management/index.tsx b/chat2db-client/src/pages/main/team/user-management/index.tsx index abf85c3e..0a22501a 100644 --- a/chat2db-client/src/pages/main/team/user-management/index.tsx +++ b/chat2db-client/src/pages/main/team/user-management/index.tsx @@ -35,23 +35,23 @@ function UserManagement() { const columns = useMemo( () => [ { - title: '用户名', + title: i18n('team.user.userName'), dataIndex: 'userName', key: 'userName', }, { - title: '昵称', + title: i18n('team.user.nickName'), dataIndex: 'nickName', key: 'nickName', }, { - title: '状态', + title: i18n('team.user.status'), dataIndex: 'status', key: 'status', render: (status: StatusType) => {status}, }, { - title: '操作', + title: i18n('common.text.action'), key: 'action', width: 260, render: (_: any, record: IUserVO) => ( @@ -69,7 +69,7 @@ function UserManagement() { id: record.id, }) }}> - 所属团队 + {i18n('team.action.affiliation.team')} { await deleteUser({ id }) - message.success('删除成功') + message.success(i18n('common.text.successfullyDelete')) queryUserList() } @@ -155,8 +155,8 @@ function UserManagement() {
} /> @@ -164,7 +164,7 @@ function UserManagement() { form.resetFields(); setIsModalVisible(true) }}> - 添加用户 + {i18n('team.action.addUser')}
{ form @@ -209,31 +209,31 @@ function UserManagement() { status: StatusType.VALID, }} > - + - + - - + - + - 管理员 - 用户 + {i18n('team.user.addForm.roleCode.admin')} + {i18n('team.user.addForm.roleCode.user')} - + - 有效 - 无效 + {i18n('team.user.addForm.status.valid')} + {i18n('team.user.addForm.status.invalid')}