Skip to content

Commit c747390

Browse files
committed
Translated error msg
1 parent b2e837f commit c747390

File tree

14 files changed

+274
-204
lines changed

14 files changed

+274
-204
lines changed

frontend/src/components/StdDataDisplay/StdCurd.vue

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ const props = defineProps({
4848
4949
const visible = ref(false)
5050
const update = ref(0)
51-
let data = reactive({id: null})
52-
let error = reactive({})
51+
const data: any = reactive({id: null})
52+
const error: any = reactive({})
5353
const params = reactive({})
5454
const selected = reactive([])
5555
@@ -64,9 +64,11 @@ function editableColumns() {
6464
}
6565
6666
function add() {
67-
data = reactive({
68-
id: null
67+
Object.keys(data).forEach(v => {
68+
delete data[v]
6969
})
70+
71+
clear_error()
7072
visible.value = true
7173
}
7274
@@ -76,31 +78,39 @@ interface Table {
7678
get_list(): void
7779
}
7880
81+
function clear_error() {
82+
Object.keys(error).forEach(v => {
83+
delete error[v]
84+
})
85+
}
86+
7987
const ok = async () => {
80-
error = reactive({})
88+
clear_error()
89+
8190
props.api!.save(data.id, data).then((r: any) => {
8291
message.success($gettext('Save Successfully'))
8392
Object.assign(data, r)
8493
const t: Table | null = table.value
8594
t!.get_list()
8695
8796
}).catch((e: any) => {
88-
message.error((e?.message ?? $gettext('Server error')), 5)
89-
error = e.errors
97+
message.error($gettext(e?.message ?? 'Server error'), 5)
98+
Object.assign(error, e.errors)
9099
})
91100
}
92101
93102
function cancel() {
94103
visible.value = false
95-
error = reactive({})
104+
105+
clear_error()
96106
}
97107
98108
function edit(id: any) {
99109
props.api!.get(id).then((r: any) => {
100110
Object.assign(data, r)
101111
visible.value = true
102112
}).catch((e: any) => {
103-
message.error((e?.message ?? $gettext('Server error')), 5)
113+
message.error($gettext(e?.message ?? 'Server error'), 5)
104114
})
105115
}
106116

frontend/src/components/StdDataDisplay/StdTable.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ let params = reactive({
7474
...route.query,
7575
...props.get_params
7676
})
77-
let selectedRowKeys = ref([])
77+
const selectedRowKeys = ref([])
7878
const rowSelection = reactive({})
7979
8080
const searchColumns = getSearchColumns()
@@ -91,7 +91,7 @@ function destroy(id: any) {
9191
get_list()
9292
message.success(interpolate($gettext('Delete ID: %{id}'), {id: id}))
9393
}).catch((e: any) => {
94-
message.error(e?.message ?? $gettext('Server error'))
94+
message.error($gettext(e?.message ?? 'Server error'))
9595
})
9696
}
9797
@@ -149,7 +149,7 @@ function checked(c: any) {
149149
}
150150
151151
function onSelectChange(_selectedRowKeys: any) {
152-
selectedRowKeys = reactive(_selectedRowKeys)
152+
selectedRowKeys.value = _selectedRowKeys
153153
// this.$emit('selected', selectedRowKeys)
154154
}
155155

frontend/src/language/constants.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ import gettext from '@/gettext'
33
const {$gettext} = gettext
44

55
export const msg = [
6-
$gettext('The username or password is incorrect')
6+
$gettext('The username or password is incorrect'),
7+
$gettext('Prohibit changing root password in demo'),
8+
$gettext('Prohibit deleting the default user'),
9+
$gettext('Failed to get certificate information'),
710
]

frontend/src/language/en/app.po

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ msgstr "About"
1818
msgid "Action"
1919
msgstr "Action"
2020

21-
#: src/components/StdDataDisplay/StdCurd.vue:113
21+
#: src/components/StdDataDisplay/StdCurd.vue:123
2222
#: src/components/StdDataDisplay/StdCurd.vue:24
2323
msgid "Add"
2424
msgstr ""
@@ -247,6 +247,10 @@ msgstr "Failed to disable %{msg}"
247247
msgid "Failed to enable %{msg}"
248248
msgstr "Failed to enable %{msg}"
249249

250+
#: src/language/constants.ts:9
251+
msgid "Failed to get certificate information"
252+
msgstr ""
253+
250254
#: src/views/other/Error.vue:3 src/views/other/Error.vue:4
251255
msgid "File Not Found"
252256
msgstr "File Not Found"
@@ -431,6 +435,14 @@ msgstr "Please input your password!"
431435
msgid "Please input your username!"
432436
msgstr "Please input your username!"
433437

438+
#: src/language/constants.ts:7
439+
msgid "Prohibit changing root password in demo"
440+
msgstr ""
441+
442+
#: src/language/constants.ts:8
443+
msgid "Prohibit deleting the default user"
444+
msgstr ""
445+
434446
#: src/views/other/About.vue:19
435447
msgid "Project Team"
436448
msgstr "Project Team"
@@ -461,7 +473,7 @@ msgstr "Save Directive"
461473
msgid "Save error %{msg}"
462474
msgstr "Save error %{msg}"
463475

464-
#: src/components/StdDataDisplay/StdCurd.vue:82
476+
#: src/components/StdDataDisplay/StdCurd.vue:91
465477
#, fuzzy
466478
msgid "Save Successfully"
467479
msgstr "Saved successfully"
@@ -475,8 +487,6 @@ msgstr "Saved successfully"
475487
msgid "Send"
476488
msgstr "Send"
477489

478-
#: src/components/StdDataDisplay/StdCurd.vue:103
479-
#: src/components/StdDataDisplay/StdCurd.vue:88
480490
#: src/components/StdDataDisplay/StdTable.vue:112
481491
#: src/components/StdDataDisplay/StdTable.vue:94
482492
#: src/views/config/ConfigEdit.vue:22 src/views/domain/DomainEdit.vue:44

frontend/src/language/messages.pot

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ msgstr ""
1212
msgid "Action"
1313
msgstr ""
1414

15-
#: src/components/StdDataDisplay/StdCurd.vue:113
15+
#: src/components/StdDataDisplay/StdCurd.vue:123
1616
#: src/components/StdDataDisplay/StdCurd.vue:24
1717
msgid "Add"
1818
msgstr ""
@@ -249,6 +249,10 @@ msgstr ""
249249
msgid "Failed to enable %{msg}"
250250
msgstr ""
251251

252+
#: src/language/constants.ts:9
253+
msgid "Failed to get certificate information"
254+
msgstr ""
255+
252256
#: src/views/other/Error.vue:3
253257
#: src/views/other/Error.vue:4
254258
msgid "File Not Found"
@@ -433,6 +437,14 @@ msgstr ""
433437
msgid "Please input your username!"
434438
msgstr ""
435439

440+
#: src/language/constants.ts:7
441+
msgid "Prohibit changing root password in demo"
442+
msgstr ""
443+
444+
#: src/language/constants.ts:8
445+
msgid "Prohibit deleting the default user"
446+
msgstr ""
447+
436448
#: src/views/other/About.vue:19
437449
msgid "Project Team"
438450
msgstr ""
@@ -466,7 +478,7 @@ msgstr ""
466478
msgid "Save error %{msg}"
467479
msgstr ""
468480

469-
#: src/components/StdDataDisplay/StdCurd.vue:82
481+
#: src/components/StdDataDisplay/StdCurd.vue:91
470482
msgid "Save Successfully"
471483
msgstr ""
472484

@@ -481,8 +493,6 @@ msgstr ""
481493
msgid "Send"
482494
msgstr ""
483495

484-
#: src/components/StdDataDisplay/StdCurd.vue:103
485-
#: src/components/StdDataDisplay/StdCurd.vue:88
486496
#: src/components/StdDataDisplay/StdTable.vue:112
487497
#: src/components/StdDataDisplay/StdTable.vue:94
488498
#: src/views/config/ConfigEdit.vue:22

frontend/src/language/translations.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

frontend/src/language/zh_CN/app.mo

287 Bytes
Binary file not shown.

frontend/src/language/zh_CN/app.po

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ msgstr "关于"
2121
msgid "Action"
2222
msgstr "操作"
2323

24-
#: src/components/StdDataDisplay/StdCurd.vue:113
24+
#: src/components/StdDataDisplay/StdCurd.vue:123
2525
#: src/components/StdDataDisplay/StdCurd.vue:24
2626
msgid "Add"
2727
msgstr "添加"
@@ -248,6 +248,10 @@ msgstr "禁用失败 %{msg}"
248248
msgid "Failed to enable %{msg}"
249249
msgstr "启用失败 %{msg}"
250250

251+
#: src/language/constants.ts:9
252+
msgid "Failed to get certificate information"
253+
msgstr "获取证书信息失败"
254+
251255
#: src/views/other/Error.vue:3 src/views/other/Error.vue:4
252256
msgid "File Not Found"
253257
msgstr "未找到文件"
@@ -428,6 +432,14 @@ msgstr "请输入您的密码!"
428432
msgid "Please input your username!"
429433
msgstr "请输入您的用户名!"
430434

435+
#: src/language/constants.ts:7
436+
msgid "Prohibit changing root password in demo"
437+
msgstr "禁止在演示模式下修改 root 账户的密码"
438+
439+
#: src/language/constants.ts:8
440+
msgid "Prohibit deleting the default user"
441+
msgstr "禁止删除默认用户"
442+
431443
#: src/views/other/About.vue:19
432444
msgid "Project Team"
433445
msgstr "项目团队"
@@ -458,7 +470,7 @@ msgstr "保存指令"
458470
msgid "Save error %{msg}"
459471
msgstr "保存错误 %{msg}"
460472

461-
#: src/components/StdDataDisplay/StdCurd.vue:82
473+
#: src/components/StdDataDisplay/StdCurd.vue:91
462474
msgid "Save Successfully"
463475
msgstr "保存成功"
464476

@@ -471,8 +483,6 @@ msgstr "保存成功"
471483
msgid "Send"
472484
msgstr "上传"
473485

474-
#: src/components/StdDataDisplay/StdCurd.vue:103
475-
#: src/components/StdDataDisplay/StdCurd.vue:88
476486
#: src/components/StdDataDisplay/StdTable.vue:112
477487
#: src/components/StdDataDisplay/StdTable.vue:94
478488
#: src/views/config/ConfigEdit.vue:22 src/views/domain/DomainEdit.vue:44

frontend/src/language/zh_TW/app.po

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ msgstr "關於"
2222
msgid "Action"
2323
msgstr "操作"
2424

25-
#: src/components/StdDataDisplay/StdCurd.vue:113
25+
#: src/components/StdDataDisplay/StdCurd.vue:123
2626
#: src/components/StdDataDisplay/StdCurd.vue:24
2727
msgid "Add"
2828
msgstr ""
@@ -252,6 +252,10 @@ msgstr "禁用失敗 %{msg}"
252252
msgid "Failed to enable %{msg}"
253253
msgstr "啟用失敗 %{msg}"
254254

255+
#: src/language/constants.ts:9
256+
msgid "Failed to get certificate information"
257+
msgstr ""
258+
255259
#: src/views/other/Error.vue:3 src/views/other/Error.vue:4
256260
msgid "File Not Found"
257261
msgstr "未找到檔案"
@@ -436,6 +440,14 @@ msgstr "請輸入您的密碼!"
436440
msgid "Please input your username!"
437441
msgstr "請輸入您的使用者名稱!"
438442

443+
#: src/language/constants.ts:7
444+
msgid "Prohibit changing root password in demo"
445+
msgstr ""
446+
447+
#: src/language/constants.ts:8
448+
msgid "Prohibit deleting the default user"
449+
msgstr ""
450+
439451
#: src/views/other/About.vue:19
440452
msgid "Project Team"
441453
msgstr "專案團隊"
@@ -466,7 +478,7 @@ msgstr "儲存指令"
466478
msgid "Save error %{msg}"
467479
msgstr "儲存錯誤 %{msg}"
468480

469-
#: src/components/StdDataDisplay/StdCurd.vue:82
481+
#: src/components/StdDataDisplay/StdCurd.vue:91
470482
#, fuzzy
471483
msgid "Save Successfully"
472484
msgstr "儲存成功"
@@ -480,8 +492,6 @@ msgstr "儲存成功"
480492
msgid "Send"
481493
msgstr "上傳"
482494

483-
#: src/components/StdDataDisplay/StdCurd.vue:103
484-
#: src/components/StdDataDisplay/StdCurd.vue:88
485495
#: src/components/StdDataDisplay/StdTable.vue:112
486496
#: src/components/StdDataDisplay/StdTable.vue:94
487497
#: src/views/config/ConfigEdit.vue:22 src/views/domain/DomainEdit.vue:44

server/api/cert.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ func CertInfo(c *gin.Context) {
1717

1818
if err != nil {
1919
c.JSON(http.StatusOK, gin.H{
20-
"error": err,
20+
"message": "Failed to get cert information",
21+
"error": err,
2122
})
2223
return
2324
}

0 commit comments

Comments
 (0)