Add internationalization support for SSH key management UI

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-11-19 15:46:18 +00:00
parent bfc26f4791
commit 06123c1fca
5 changed files with 54 additions and 32 deletions

View File

@ -44,7 +44,7 @@ export default {
}, },
{ {
path: '/sshKey', path: '/sshKey',
name: 'SSH密钥', name: intl.get('SSH密钥'),
icon: <IconFont type="ql-icon-key" />, icon: <IconFont type="ql-icon-key" />,
component: '@/pages/sshKey/index', component: '@/pages/sshKey/index',
}, },

View File

@ -104,7 +104,7 @@
"序号": "Number", "序号": "Number",
"备注": "Remarks", "备注": "Remarks",
"更新时间": "Update Time", "更新时间": "Update Time",
"创建时间": "Creation Time", "创建时间": "Created Time",
"确认删除依赖": "Confirm to delete the dependency", "确认删除依赖": "Confirm to delete the dependency",
"确认重新安装": "Confirm to reinstall", "确认重新安装": "Confirm to reinstall",
"确认取消安装": "Confirm to cancel install", "确认取消安装": "Confirm to cancel install",
@ -252,7 +252,7 @@
"登录日志": "Login Logs", "登录日志": "Login Logs",
"其他设置": "Other Settings", "其他设置": "Other Settings",
"关于": "About", "关于": "About",
"成功": "Success", "成功": "Successfully",
"失败": "Failure", "失败": "Failure",
"登录时间": "Login Time", "登录时间": "Login Time",
"登录地址": "Login Address", "登录地址": "Login Address",
@ -538,5 +538,16 @@
"单实例模式:定时启动新任务前会自动停止旧任务;多实例模式:允许同时运行多个任务实例": "Single instance mode: automatically stop old task before starting new scheduled task; Multi-instance mode: allow multiple task instances to run simultaneously", "单实例模式:定时启动新任务前会自动停止旧任务;多实例模式:允许同时运行多个任务实例": "Single instance mode: automatically stop old task before starting new scheduled task; Multi-instance mode: allow multiple task instances to run simultaneously",
"请选择实例模式": "Please select instance mode", "请选择实例模式": "Please select instance mode",
"单实例": "Single Instance", "单实例": "Single Instance",
"多实例": "Multi-Instance" "多实例": "Multi-Instance",
"SSH密钥": "SSH Keys",
"别名": "Alias",
"编辑SSH密钥": "Edit SSH Key",
"创建SSH密钥": "Create SSH Key",
"更新SSH密钥成功": "SSH key updated successfully",
"创建SSH密钥成功": "SSH key created successfully",
"请输入SSH密钥别名": "Please enter SSH key alias",
"请输入SSH私钥": "Please enter SSH private key",
"请输入SSH私钥内容以 -----BEGIN 开头)": "Please enter SSH private key content (starts with -----BEGIN)",
"确认删除SSH密钥": "Confirm to delete SSH key",
"批量": "Batch"
} }

View File

@ -538,5 +538,16 @@
"单实例模式:定时启动新任务前会自动停止旧任务;多实例模式:允许同时运行多个任务实例": "单实例模式:定时启动新任务前会自动停止旧任务;多实例模式:允许同时运行多个任务实例", "单实例模式:定时启动新任务前会自动停止旧任务;多实例模式:允许同时运行多个任务实例": "单实例模式:定时启动新任务前会自动停止旧任务;多实例模式:允许同时运行多个任务实例",
"请选择实例模式": "请选择实例模式", "请选择实例模式": "请选择实例模式",
"单实例": "单实例", "单实例": "单实例",
"多实例": "多实例" "多实例": "多实例",
"SSH密钥": "SSH密钥",
"别名": "别名",
"编辑SSH密钥": "编辑SSH密钥",
"创建SSH密钥": "创建SSH密钥",
"更新SSH密钥成功": "更新SSH密钥成功",
"创建SSH密钥成功": "创建SSH密钥成功",
"请输入SSH密钥别名": "请输入SSH密钥别名",
"请输入SSH私钥": "请输入SSH私钥",
"请输入SSH私钥内容以 -----BEGIN 开头)": "请输入SSH私钥内容以 -----BEGIN 开头)",
"确认删除SSH密钥": "确认删除SSH密钥",
"批量": "批量"
} }

View File

@ -55,14 +55,14 @@ const SshKey = () => {
const { headerStyle, isPhone, theme } = useOutletContext<SharedContext>(); const { headerStyle, isPhone, theme } = useOutletContext<SharedContext>();
const columns: any = [ const columns: any = [
{ {
title: '序号', title: intl.get('序号'),
width: 80, width: 80,
render: (text: string, record: any, index: number) => { render: (text: string, record: any, index: number) => {
return <span style={{ cursor: 'text' }}>{index + 1} </span>; return <span style={{ cursor: 'text' }}>{index + 1} </span>;
}, },
}, },
{ {
title: '别名', title: intl.get('别名'),
dataIndex: 'alias', dataIndex: 'alias',
key: 'alias', key: 'alias',
sorter: (a: any, b: any) => a.alias.localeCompare(b.alias), sorter: (a: any, b: any) => a.alias.localeCompare(b.alias),
@ -78,7 +78,7 @@ const SshKey = () => {
}, },
}, },
{ {
title: '备注', title: intl.get('备注'),
dataIndex: 'remarks', dataIndex: 'remarks',
key: 'remarks', key: 'remarks',
width: '35%', width: '35%',
@ -92,17 +92,17 @@ const SshKey = () => {
}, },
}, },
{ {
title: '状态', title: intl.get('状态'),
key: 'status', key: 'status',
dataIndex: 'status', dataIndex: 'status',
width: 90, width: 90,
filters: [ filters: [
{ {
text: '已启用', text: intl.get('已启用'),
value: 0, value: 0,
}, },
{ {
text: '已禁用', text: intl.get('已禁用'),
value: 1, value: 1,
}, },
], ],
@ -112,7 +112,7 @@ const SshKey = () => {
}, },
}, },
{ {
title: '创建时间', title: intl.get('创建时间'),
dataIndex: 'createdAt', dataIndex: 'createdAt',
key: 'createdAt', key: 'createdAt',
width: 185, width: 185,
@ -127,7 +127,7 @@ const SshKey = () => {
}, },
}, },
{ {
title: '操作', title: intl.get('操作'),
key: 'action', key: 'action',
width: 120, width: 120,
render: (text: string, record: any, index: number) => { render: (text: string, record: any, index: number) => {
@ -145,7 +145,7 @@ const SshKey = () => {
{OperationName[record.status]} {OperationName[record.status]}
</a> </a>
</Tooltip> </Tooltip>
<Tooltip title="编辑"> <Tooltip title={intl.get('编辑')}>
<a <a
onClick={() => { onClick={() => {
editSSHKey(record); editSSHKey(record);
@ -154,7 +154,7 @@ const SshKey = () => {
<EditOutlined /> <EditOutlined />
</a> </a>
</Tooltip> </Tooltip>
<Tooltip title="删除"> <Tooltip title={intl.get('删除')}>
<a <a
onClick={() => { onClick={() => {
deleteSSHKey(record); deleteSSHKey(record);
@ -199,14 +199,14 @@ const SshKey = () => {
const deleteSSHKey = (record: any) => { const deleteSSHKey = (record: any) => {
Modal.confirm({ Modal.confirm({
title: '确认删除', title: intl.get('确认删除'),
content: ( content: (
<> <>
SSH密钥 {intl.get('确认删除SSH密钥')}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.alias} {record.alias}
</Text> </Text>
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@ -214,7 +214,7 @@ const SshKey = () => {
.delete(`${config.apiPrefix}sshKeys`, [record.id]) .delete(`${config.apiPrefix}sshKeys`, [record.id])
.then(({ code, data }) => { .then(({ code, data }) => {
if (code === 200) { if (code === 200) {
message.success('删除成功'); message.success(intl.get('删除成功'));
getSSHKeys(); getSSHKeys();
} }
}); });
@ -230,7 +230,7 @@ const SshKey = () => {
.put(`${config.apiPrefix}sshKeys/${operationPath}`, ids) .put(`${config.apiPrefix}sshKeys/${operationPath}`, ids)
.then(({ code, data }) => { .then(({ code, data }) => {
if (code === 200) { if (code === 200) {
message.success(`批量${OperationName[OperationPath[operationPath]]}成功`); message.success(`${intl.get('批量')}${OperationName[OperationPath[operationPath]]}${intl.get('成功')}`);
getSSHKeys(false); getSSHKeys(false);
} }
}); });
@ -266,10 +266,10 @@ const SshKey = () => {
return ( return (
<PageContainer <PageContainer
className="ql-container-wrapper" className="ql-container-wrapper"
title="SSH密钥" title={intl.get('SSH密钥')}
extra={[ extra={[
<Button key="1" type="primary" onClick={addSSHKey}> <Button key="1" type="primary" onClick={addSSHKey}>
{intl.get('新建')}
</Button>, </Button>,
]} ]}
header={{ header={{

View File

@ -26,7 +26,7 @@ const SshKeyModal = ({
if (code === 200) { if (code === 200) {
message.success( message.success(
sshKey ? '更新SSH密钥成功' : '创建SSH密钥成功', sshKey ? intl.get('更新SSH密钥成功') : intl.get('创建SSH密钥成功'),
); );
handleCancel(data); handleCancel(data);
} }
@ -38,7 +38,7 @@ const SshKeyModal = ({
return ( return (
<Modal <Modal
title={sshKey ? '编辑SSH密钥' : '创建SSH密钥'} title={sshKey ? intl.get('编辑SSH密钥') : intl.get('创建SSH密钥')}
open={true} open={true}
forceRender forceRender
centered centered
@ -59,35 +59,35 @@ const SshKeyModal = ({
<Form form={form} layout="vertical" name="ssh_key_modal" initialValues={sshKey}> <Form form={form} layout="vertical" name="ssh_key_modal" initialValues={sshKey}>
<Form.Item <Form.Item
name="alias" name="alias"
label="别名" label={intl.get('别名')}
rules={[ rules={[
{ {
required: true, required: true,
message: '请输入SSH密钥别名', message: intl.get('请输入SSH密钥别名'),
whitespace: true, whitespace: true,
}, },
]} ]}
> >
<Input placeholder="请输入SSH密钥别名" disabled={!!sshKey} /> <Input placeholder={intl.get('请输入SSH密钥别名')} disabled={!!sshKey} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="private_key" name="private_key"
label="私钥" label={intl.get('私钥')}
rules={[ rules={[
{ {
required: true, required: true,
message: '请输入SSH私钥', message: intl.get('请输入SSH私钥'),
whitespace: true, whitespace: true,
}, },
]} ]}
> >
<Input.TextArea <Input.TextArea
autoSize={{ minRows: 4, maxRows: 12 }} autoSize={{ minRows: 4, maxRows: 12 }}
placeholder="请输入SSH私钥内容以 -----BEGIN 开头)" placeholder={intl.get('请输入SSH私钥内容以 -----BEGIN 开头)')}
/> />
</Form.Item> </Form.Item>
<Form.Item name="remarks" label="备注"> <Form.Item name="remarks" label={intl.get('备注')}>
<Input placeholder="请输入备注" /> <Input placeholder={intl.get('请输入备注')} />
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>