From 06123c1fca133c3f25f707dac020d3b2d1a5b13c Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 19 Nov 2025 15:46:18 +0000
Subject: [PATCH] Add internationalization support for SSH key management UI
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
---
src/layouts/defaultProps.tsx | 2 +-
src/locales/en-US.json | 17 ++++++++++++++---
src/locales/zh-CN.json | 13 ++++++++++++-
src/pages/sshKey/index.tsx | 34 +++++++++++++++++-----------------
src/pages/sshKey/modal.tsx | 20 ++++++++++----------
5 files changed, 54 insertions(+), 32 deletions(-)
diff --git a/src/layouts/defaultProps.tsx b/src/layouts/defaultProps.tsx
index ddc5a3de..70e43d65 100644
--- a/src/layouts/defaultProps.tsx
+++ b/src/layouts/defaultProps.tsx
@@ -44,7 +44,7 @@ export default {
},
{
path: '/sshKey',
- name: 'SSH密钥',
+ name: intl.get('SSH密钥'),
icon: ,
component: '@/pages/sshKey/index',
},
diff --git a/src/locales/en-US.json b/src/locales/en-US.json
index 4b2fbdc1..e9edb7c0 100644
--- a/src/locales/en-US.json
+++ b/src/locales/en-US.json
@@ -104,7 +104,7 @@
"序号": "Number",
"备注": "Remarks",
"更新时间": "Update Time",
- "创建时间": "Creation Time",
+ "创建时间": "Created Time",
"确认删除依赖": "Confirm to delete the dependency",
"确认重新安装": "Confirm to reinstall",
"确认取消安装": "Confirm to cancel install",
@@ -252,7 +252,7 @@
"登录日志": "Login Logs",
"其他设置": "Other Settings",
"关于": "About",
- "成功": "Success",
+ "成功": "Successfully",
"失败": "Failure",
"登录时间": "Login Time",
"登录地址": "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",
"请选择实例模式": "Please select instance mode",
"单实例": "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"
}
diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json
index fdb1ca10..4ba77dd5 100644
--- a/src/locales/zh-CN.json
+++ b/src/locales/zh-CN.json
@@ -538,5 +538,16 @@
"单实例模式:定时启动新任务前会自动停止旧任务;多实例模式:允许同时运行多个任务实例": "单实例模式:定时启动新任务前会自动停止旧任务;多实例模式:允许同时运行多个任务实例",
"请选择实例模式": "请选择实例模式",
"单实例": "单实例",
- "多实例": "多实例"
+ "多实例": "多实例",
+ "SSH密钥": "SSH密钥",
+ "别名": "别名",
+ "编辑SSH密钥": "编辑SSH密钥",
+ "创建SSH密钥": "创建SSH密钥",
+ "更新SSH密钥成功": "更新SSH密钥成功",
+ "创建SSH密钥成功": "创建SSH密钥成功",
+ "请输入SSH密钥别名": "请输入SSH密钥别名",
+ "请输入SSH私钥": "请输入SSH私钥",
+ "请输入SSH私钥内容(以 -----BEGIN 开头)": "请输入SSH私钥内容(以 -----BEGIN 开头)",
+ "确认删除SSH密钥": "确认删除SSH密钥",
+ "批量": "批量"
}
diff --git a/src/pages/sshKey/index.tsx b/src/pages/sshKey/index.tsx
index 131c699b..353ea826 100644
--- a/src/pages/sshKey/index.tsx
+++ b/src/pages/sshKey/index.tsx
@@ -55,14 +55,14 @@ const SshKey = () => {
const { headerStyle, isPhone, theme } = useOutletContext();
const columns: any = [
{
- title: '序号',
+ title: intl.get('序号'),
width: 80,
render: (text: string, record: any, index: number) => {
return {index + 1} ;
},
},
{
- title: '别名',
+ title: intl.get('别名'),
dataIndex: 'alias',
key: 'alias',
sorter: (a: any, b: any) => a.alias.localeCompare(b.alias),
@@ -78,7 +78,7 @@ const SshKey = () => {
},
},
{
- title: '备注',
+ title: intl.get('备注'),
dataIndex: 'remarks',
key: 'remarks',
width: '35%',
@@ -92,17 +92,17 @@ const SshKey = () => {
},
},
{
- title: '状态',
+ title: intl.get('状态'),
key: 'status',
dataIndex: 'status',
width: 90,
filters: [
{
- text: '已启用',
+ text: intl.get('已启用'),
value: 0,
},
{
- text: '已禁用',
+ text: intl.get('已禁用'),
value: 1,
},
],
@@ -112,7 +112,7 @@ const SshKey = () => {
},
},
{
- title: '创建时间',
+ title: intl.get('创建时间'),
dataIndex: 'createdAt',
key: 'createdAt',
width: 185,
@@ -127,7 +127,7 @@ const SshKey = () => {
},
},
{
- title: '操作',
+ title: intl.get('操作'),
key: 'action',
width: 120,
render: (text: string, record: any, index: number) => {
@@ -145,7 +145,7 @@ const SshKey = () => {
{OperationName[record.status]}
-
+
{
editSSHKey(record);
@@ -154,7 +154,7 @@ const SshKey = () => {
-
+
{
deleteSSHKey(record);
@@ -199,14 +199,14 @@ const SshKey = () => {
const deleteSSHKey = (record: any) => {
Modal.confirm({
- title: '确认删除',
+ title: intl.get('确认删除'),
content: (
<>
- 确认删除SSH密钥
+ {intl.get('确认删除SSH密钥')}
{record.alias}
- 吗
+ {intl.get('吗')}
>
),
onOk() {
@@ -214,7 +214,7 @@ const SshKey = () => {
.delete(`${config.apiPrefix}sshKeys`, [record.id])
.then(({ code, data }) => {
if (code === 200) {
- message.success('删除成功');
+ message.success(intl.get('删除成功'));
getSSHKeys();
}
});
@@ -230,7 +230,7 @@ const SshKey = () => {
.put(`${config.apiPrefix}sshKeys/${operationPath}`, ids)
.then(({ code, data }) => {
if (code === 200) {
- message.success(`批量${OperationName[OperationPath[operationPath]]}成功`);
+ message.success(`${intl.get('批量')}${OperationName[OperationPath[operationPath]]}${intl.get('成功')}`);
getSSHKeys(false);
}
});
@@ -266,10 +266,10 @@ const SshKey = () => {
return (
- 新建
+ {intl.get('新建')}
,
]}
header={{
diff --git a/src/pages/sshKey/modal.tsx b/src/pages/sshKey/modal.tsx
index a8a42ebf..a0728c30 100644
--- a/src/pages/sshKey/modal.tsx
+++ b/src/pages/sshKey/modal.tsx
@@ -26,7 +26,7 @@ const SshKeyModal = ({
if (code === 200) {
message.success(
- sshKey ? '更新SSH密钥成功' : '创建SSH密钥成功',
+ sshKey ? intl.get('更新SSH密钥成功') : intl.get('创建SSH密钥成功'),
);
handleCancel(data);
}
@@ -38,7 +38,7 @@ const SshKeyModal = ({
return (
-
+
-
-
+
+