Skip to content

Commit dd4c5c6

Browse files
committed
refactor: complete i18n internationalization and fix TypeScript types
- Update TRouterInfo.title to accept only Record<string, string> for strict multilingual support - Add multilingual title handling in layouts/index.vue with fallback for string titles - Remove unused reactive import from detail/deploy/index.vue - All 22 modified files now have proper i18n configuration
1 parent 4b2e7b4 commit dd4c5c6

File tree

24 files changed

+400
-159
lines changed

24 files changed

+400
-159
lines changed

src/components/common-table/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ const onConfirmDelete = () => {
256256
data.value.splice(deleteIdx.value, 1);
257257
pagination.value.total = data.value.length;
258258
confirmVisible.value = false;
259-
MessagePlugin.success('删除成功');
259+
MessagePlugin.success(t('components.deleteSuccess'));
260260
resetIdx();
261261
};
262262

src/layouts/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ const appendNewRoute = () => {
5555
meta: { title },
5656
name,
5757
} = route;
58-
tabsRouterStore.appendTabRouterList({ path, query, title: title as string, name, isAlive: true, meta: route.meta });
58+
const titleObj = typeof title === 'string' ? { zh_CN: title, en_US: title } : title;
59+
tabsRouterStore.appendTabRouterList({ path, query, title: titleObj, name, isAlive: true, meta: route.meta });
5960
};
6061
6162
onMounted(() => {

src/layouts/setting.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,11 @@ const handleCopy = () => {
181181
copy()
182182
.then(() => {
183183
MessagePlugin.closeAll();
184-
MessagePlugin.success('复制成功');
184+
MessagePlugin.success(t('components.copySuccess'));
185185
})
186186
.catch(() => {
187187
MessagePlugin.closeAll();
188-
MessagePlugin.error('复制失败');
188+
MessagePlugin.error(t('components.copyFail'));
189189
});
190190
};
191191
const getModeIcon = (mode: string) => {

src/locales/lang/en_US.json

Lines changed: 98 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
},
88
"manage": "Manage",
99
"delete": "Delete",
10+
"deleteSuccess": "Deleted successfully",
11+
"copySuccess": "Copied successfully",
12+
"copyFail": "Copy failed",
13+
"submitSuccess": "Submitted successfully",
1014
"commonTable": {
1115
"contractName": "Name",
1216
"contractStatus": "Status",
@@ -327,6 +331,25 @@
327331
"manage": "manage",
328332
"delete": "delete"
329333
}
334+
},
335+
"baseInfo": {
336+
"clusterName": "Cluster Name",
337+
"clusterId": "Cluster ID",
338+
"status": "Status",
339+
"running": "Running",
340+
"k8sVersion": "K8S Version",
341+
"config": "Config",
342+
"region": "Region",
343+
"guangzhou": "Guangzhou",
344+
"project": "Resource Project",
345+
"defaultProject": "Default Project",
346+
"nodeCount": "Node Count",
347+
"nodeNetwork": "Node Network",
348+
"containerNetwork": "Container Network",
349+
"clusterCredential": "Cluster Credential",
350+
"showCredential": "Show Credential",
351+
"createUpdate": "Create/Update",
352+
"description": "Description"
330353
}
331354
},
332355
"detailSecondary": {
@@ -336,11 +359,14 @@
336359
"setRead": "set as read",
337360
"setUnread": "set as unread",
338361
"delete": "delete",
362+
"deleteConfirm": "Delete notification",
363+
"deleteTip": "Confirm delete notification: {content}?",
339364
"empty": "Empty"
340365
},
341366
"formBase": {
342367
"title": "Contract Info",
343368
"contractName": "Name",
369+
"contractNamePlaceholder": "Please enter contract name",
344370
"contractStatus": "Status",
345371
"contractNum": "Number",
346372
"contractType": "Type",
@@ -362,10 +388,57 @@
362388
"remark": "Remark",
363389
"remarkPlaceholder": "please enter remark",
364390
"notaryPublic": "Notary Public",
391+
"fileSizeExceed": "File size cannot exceed 60MB",
392+
"uploadFail": "Upload failed",
365393
"confirm": "confirm",
366-
"cancel": "cancel"
394+
"cancel": "cancel",
395+
"validation": {
396+
"name": "Please enter contract name",
397+
"type": "Please select contract type",
398+
"payment": "Please select payment type",
399+
"amount": "Please enter amount",
400+
"partyA": "Please select Party A",
401+
"partyB": "Please select Party B",
402+
"signDate": "Please select date",
403+
"startDate": "Please select date",
404+
"endDate": "Please select date"
405+
},
406+
"typeOptions": {
407+
"typeA": "Type A",
408+
"typeB": "Type B",
409+
"typeC": "Type C"
410+
},
411+
"partyOptions": {
412+
"companyA": "Company A",
413+
"companyB": "Company B",
414+
"companyC": "Company C"
415+
}
367416
},
368417
"formStep": {
418+
"validation": {
419+
"name": "Please select contract name",
420+
"type": "Please select type",
421+
"title": "Please enter invoice title",
422+
"taxNum": "Please enter tax number",
423+
"consignee": "Please enter consignee",
424+
"mobileNum": "Please enter mobile number",
425+
"deliveryAddress": "Please select delivery address",
426+
"fullAddress": "Please enter full address"
427+
},
428+
"options": {
429+
"nameA": "Contract A",
430+
"nameB": "Contract B",
431+
"nameC": "Contract C",
432+
"typeA": "Type A",
433+
"typeB": "Type B",
434+
"typeC": "Type C",
435+
"address1": "Nanshan District, Shenzhen, Guangdong",
436+
"address2": "Haidian District, Beijing",
437+
"address3": "Xuhui District, Shanghai",
438+
"address4": "High-tech Zone, Chengdu, Sichuan",
439+
"address5": "Tianhe District, Guangzhou, Guangdong",
440+
"address6": "High-tech Zone, Xi'an, Shaanxi"
441+
},
369442
"step1": {
370443
"title": "Submit Application",
371444
"subtitle": "Submitted on December 21st",
@@ -444,6 +517,10 @@
444517
"listCard": {
445518
"create": "Create Product",
446519
"placeholder": "please enter to search",
520+
"loading": "Loading data...",
521+
"deleteConfirm": "Confirm delete selected products?",
522+
"deleteSuccess": "Deleted successfully",
523+
"deleteTip": "After confirmation, all product information of {name} will be cleared and cannot be recovered",
447524
"productName": "Name",
448525
"productStatus": "Status",
449526
"productDescription": "Description",
@@ -456,7 +533,22 @@
456533
},
457534
"listFilter": {},
458535
"listTree": {
459-
"placeholder": "please enter to search"
536+
"placeholder": "please enter to search",
537+
"treeData": {
538+
"shenzhen": "Shenzhen HQ",
539+
"beijing": "Beijing HQ",
540+
"shanghai": "Shanghai HQ",
541+
"hunan": "Hunan",
542+
"hubei": "Hubei",
543+
"generalOffice": "General Office",
544+
"marketing": "Marketing",
545+
"technology": "Technology",
546+
"finance": "Finance",
547+
"purchase1": "Purchasing Team 1",
548+
"purchase2": "Purchasing Team 2",
549+
"finance1": "Finance Team 1",
550+
"finance2": "Finance Team 2"
551+
}
460552
},
461553
"login": {
462554
"loginTitle": "Login in",
@@ -472,6 +564,7 @@
472564
"accountLogin": "Login with Account",
473565
"phoneLogin": "Login with Mobile Phone",
474566
"loginSuccess": "Login successful",
567+
"countdown": "Resend after {count} seconds",
475568
"input": {
476569
"account": "please enter account",
477570
"password": "please enter password",
@@ -544,7 +637,9 @@
544637
"entity": "Entity",
545638
"joinDay": "Day of join",
546639
"group": "Group"
547-
}
640+
},
641+
"tencentGroup": "Tencent Group",
642+
"seniorDesigner": "Senior UI Designer"
548643
},
549644
"contentList": "Content List",
550645
"visitData": "Visit Data",

src/locales/lang/zh_CN.json

Lines changed: 98 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
},
88
"manage": "管理",
99
"delete": "删除",
10+
"deleteSuccess": "删除成功",
11+
"copySuccess": "复制成功",
12+
"copyFail": "复制失败",
13+
"submitSuccess": "提交成功",
1014
"commonTable": {
1115
"contractName": "合同名称",
1216
"contractNamePlaceholder": "请输入合同名称",
@@ -327,6 +331,25 @@
327331
"manage": "管理",
328332
"delete": "删除"
329333
}
334+
},
335+
"baseInfo": {
336+
"clusterName": "集群名",
337+
"clusterId": "集群ID",
338+
"status": "状态",
339+
"running": "运行中",
340+
"k8sVersion": "K8S版本",
341+
"config": "配置",
342+
"region": "所在地域",
343+
"guangzhou": "广州",
344+
"project": "新增资源所属项目",
345+
"defaultProject": "默认项目",
346+
"nodeCount": "节点数量",
347+
"nodeNetwork": "节点网络",
348+
"containerNetwork": "容器网络",
349+
"clusterCredential": "集群凭证",
350+
"showCredential": "显示凭证",
351+
"createUpdate": "创建/更新",
352+
"description": "描述"
330353
}
331354
},
332355
"detailSecondary": {
@@ -336,11 +359,14 @@
336359
"setRead": "设为已读",
337360
"setUnread": "设为未读",
338361
"delete": "删除通知",
362+
"deleteConfirm": "删除通知",
363+
"deleteTip": "确认删除通知:{content}吗?",
339364
"empty": "暂无通知"
340365
},
341366
"formBase": {
342367
"title": "合同信息",
343368
"contractName": "合同名称",
369+
"contractNamePlaceholder": "请输入合同名称",
344370
"contractStatus": "合同状态",
345371
"contractNum": "合同编号",
346372
"contractType": "合同类型",
@@ -362,10 +388,57 @@
362388
"remark": "备注",
363389
"remarkPlaceholder": "请输入备注",
364390
"notaryPublic": "公证人",
391+
"fileSizeExceed": "上传文件不能大于60M",
392+
"uploadFail": "上传失败",
365393
"confirm": "确认提交",
366-
"cancel": "取消"
394+
"cancel": "取消",
395+
"validation": {
396+
"name": "请输入合同名称",
397+
"type": "请选择合同类型",
398+
"payment": "请选择合同收付类型",
399+
"amount": "请输入合同金额",
400+
"partyA": "请选择甲方",
401+
"partyB": "请选择乙方",
402+
"signDate": "请选择日期",
403+
"startDate": "请选择日期",
404+
"endDate": "请选择日期"
405+
},
406+
"typeOptions": {
407+
"typeA": "类型A",
408+
"typeB": "类型B",
409+
"typeC": "类型C"
410+
},
411+
"partyOptions": {
412+
"companyA": "甲方公司",
413+
"companyB": "乙方公司",
414+
"companyC": "丙方公司"
415+
}
367416
},
368417
"formStep": {
418+
"validation": {
419+
"name": "请选择合同名称",
420+
"type": "请选择类型",
421+
"title": "请输入发票抬头",
422+
"taxNum": "请输入纳税人识别号",
423+
"consignee": "请输入收货人",
424+
"mobileNum": "请输入手机号码",
425+
"deliveryAddress": "请选择收货地址",
426+
"fullAddress": "请输入详细地址"
427+
},
428+
"options": {
429+
"nameA": "合同A",
430+
"nameB": "合同B",
431+
"nameC": "合同C",
432+
"typeA": "类型A",
433+
"typeB": "类型B",
434+
"typeC": "类型C",
435+
"address1": "广东省深圳市南山区",
436+
"address2": "北京市海淀区",
437+
"address3": "上海市徐汇区",
438+
"address4": "四川省成都市高新区",
439+
"address5": "广东省广州市天河区",
440+
"address6": "陕西省西安市高新区"
441+
},
369442
"step1": {
370443
"title": "提交申请",
371444
"subtitle": "已于12月21日提交",
@@ -446,6 +519,10 @@
446519
"listCard": {
447520
"create": "新建产品",
448521
"placeholder": "请输入内容搜索",
522+
"loading": "加载数据中...",
523+
"deleteConfirm": "确认删除所选产品?",
524+
"deleteSuccess": "删除成功",
525+
"deleteTip": "确认删除后{name}的所有产品信息将被清空, 且无法恢复",
449526
"productName": "产品名称",
450527
"productStatus": "产品状态",
451528
"productDescription": "产品描述",
@@ -458,7 +535,22 @@
458535
},
459536
"listFilter": {},
460537
"listTree": {
461-
"placeholder": "请输入内容进行搜索"
538+
"placeholder": "请输入内容进行搜索",
539+
"treeData": {
540+
"shenzhen": "深圳总部",
541+
"beijing": "北京总部",
542+
"shanghai": "上海总部",
543+
"hunan": "湖南",
544+
"hubei": "湖北",
545+
"generalOffice": "总办",
546+
"marketing": "市场部",
547+
"technology": "技术部",
548+
"finance": "财务部",
549+
"purchase1": "采购1组",
550+
"purchase2": "采购2组",
551+
"finance1": "财务1组",
552+
"finance2": "财务2组"
553+
}
462554
},
463555
"login": {
464556
"loginTitle": "登录到",
@@ -474,6 +566,7 @@
474566
"accountLogin": "使用账号登录",
475567
"phoneLogin": "使用手机号登录",
476568
"loginSuccess": "登录成功",
569+
"countdown": "{count}秒后可重发",
477570
"input": {
478571
"account": "请输入账号",
479572
"password": "请输入登录密码",
@@ -546,7 +639,9 @@
546639
"entity": "主体",
547640
"joinDay": "入职时间",
548641
"group": "所属团队"
549-
}
642+
},
643+
"tencentGroup": "腾讯集团",
644+
"seniorDesigner": "高级 UI 设计师"
550645
},
551646
"visitData": "首页访问数据",
552647
"contentList": "内容列表",

src/pages/dashboard/base/index.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@ import { getChartListColor } from '@/utils/color';
88

99
/** 首页 dashboard 折线图 */
1010
export function constructInitDashboardDataset(type: string) {
11-
const dateArray: Array<string> = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];
11+
const dateArray: Array<string> = [
12+
t('pages.dashboardBase.chart.week1'),
13+
t('pages.dashboardBase.chart.week2'),
14+
t('pages.dashboardBase.chart.week3'),
15+
t('pages.dashboardBase.chart.week4'),
16+
t('pages.dashboardBase.chart.week5'),
17+
t('pages.dashboardBase.chart.week6'),
18+
t('pages.dashboardBase.chart.week7'),
19+
];
1220

1321
const datasetAxis = {
1422
xAxis: {
@@ -41,8 +49,8 @@ export function constructInitDashboardDataset(type: string) {
4149
symbolSize: 0,
4250
markPoint: {
4351
data: [
44-
{ type: 'max', name: '最大值' },
45-
{ type: 'min', name: '最小值' },
52+
{ type: 'max', name: t('pages.dashboardBase.chart.max') },
53+
{ type: 'min', name: t('pages.dashboardBase.chart.min') },
4654
],
4755
},
4856
lineStyle: {
@@ -336,7 +344,7 @@ export function getPieChartDataSet({
336344
},
337345
series: [
338346
{
339-
name: '销售渠道',
347+
name: t('pages.dashboardBase.topPanel.analysis.channels'),
340348
type: 'pie',
341349
radius: ['48%', '60%'],
342350
avoidLabelOverlap: true,

0 commit comments

Comments
 (0)