Skip to content

Commit

Permalink
Translated error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJacky committed Aug 11, 2022
1 parent b2e837f commit c747390
Show file tree
Hide file tree
Showing 14 changed files with 274 additions and 204 deletions.
28 changes: 19 additions & 9 deletions frontend/src/components/StdDataDisplay/StdCurd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ const props = defineProps({
const visible = ref(false)
const update = ref(0)
let data = reactive({id: null})
let error = reactive({})
const data: any = reactive({id: null})
const error: any = reactive({})
const params = reactive({})
const selected = reactive([])
Expand All @@ -64,9 +64,11 @@ function editableColumns() {
}
function add() {
data = reactive({
id: null
Object.keys(data).forEach(v => {
delete data[v]
})
clear_error()
visible.value = true
}
Expand All @@ -76,31 +78,39 @@ interface Table {
get_list(): void
}
function clear_error() {
Object.keys(error).forEach(v => {
delete error[v]
})
}
const ok = async () => {
error = reactive({})
clear_error()
props.api!.save(data.id, data).then((r: any) => {
message.success($gettext('Save Successfully'))
Object.assign(data, r)
const t: Table | null = table.value
t!.get_list()
}).catch((e: any) => {
message.error((e?.message ?? $gettext('Server error')), 5)
error = e.errors
message.error($gettext(e?.message ?? 'Server error'), 5)
Object.assign(error, e.errors)
})
}
function cancel() {
visible.value = false
error = reactive({})
clear_error()
}
function edit(id: any) {
props.api!.get(id).then((r: any) => {
Object.assign(data, r)
visible.value = true
}).catch((e: any) => {
message.error((e?.message ?? $gettext('Server error')), 5)
message.error($gettext(e?.message ?? 'Server error'), 5)
})
}
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/StdDataDisplay/StdTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ let params = reactive({
...route.query,
...props.get_params
})
let selectedRowKeys = ref([])
const selectedRowKeys = ref([])
const rowSelection = reactive({})
const searchColumns = getSearchColumns()
Expand All @@ -91,7 +91,7 @@ function destroy(id: any) {
get_list()
message.success(interpolate($gettext('Delete ID: %{id}'), {id: id}))
}).catch((e: any) => {
message.error(e?.message ?? $gettext('Server error'))
message.error($gettext(e?.message ?? 'Server error'))
})
}
Expand Down Expand Up @@ -149,7 +149,7 @@ function checked(c: any) {
}
function onSelectChange(_selectedRowKeys: any) {
selectedRowKeys = reactive(_selectedRowKeys)
selectedRowKeys.value = _selectedRowKeys
// this.$emit('selected', selectedRowKeys)
}
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/language/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ import gettext from '@/gettext'
const {$gettext} = gettext

export const msg = [
$gettext('The username or password is incorrect')
$gettext('The username or password is incorrect'),
$gettext('Prohibit changing root password in demo'),
$gettext('Prohibit deleting the default user'),
$gettext('Failed to get certificate information'),
]
18 changes: 14 additions & 4 deletions frontend/src/language/en/app.po
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ msgstr "About"
msgid "Action"
msgstr "Action"

#: src/components/StdDataDisplay/StdCurd.vue:113
#: src/components/StdDataDisplay/StdCurd.vue:123
#: src/components/StdDataDisplay/StdCurd.vue:24
msgid "Add"
msgstr ""
Expand Down Expand Up @@ -247,6 +247,10 @@ msgstr "Failed to disable %{msg}"
msgid "Failed to enable %{msg}"
msgstr "Failed to enable %{msg}"

#: src/language/constants.ts:9
msgid "Failed to get certificate information"
msgstr ""

#: src/views/other/Error.vue:3 src/views/other/Error.vue:4
msgid "File Not Found"
msgstr "File Not Found"
Expand Down Expand Up @@ -431,6 +435,14 @@ msgstr "Please input your password!"
msgid "Please input your username!"
msgstr "Please input your username!"

#: src/language/constants.ts:7
msgid "Prohibit changing root password in demo"
msgstr ""

#: src/language/constants.ts:8
msgid "Prohibit deleting the default user"
msgstr ""

#: src/views/other/About.vue:19
msgid "Project Team"
msgstr "Project Team"
Expand Down Expand Up @@ -461,7 +473,7 @@ msgstr "Save Directive"
msgid "Save error %{msg}"
msgstr "Save error %{msg}"

#: src/components/StdDataDisplay/StdCurd.vue:82
#: src/components/StdDataDisplay/StdCurd.vue:91
#, fuzzy
msgid "Save Successfully"
msgstr "Saved successfully"
Expand All @@ -475,8 +487,6 @@ msgstr "Saved successfully"
msgid "Send"
msgstr "Send"

#: src/components/StdDataDisplay/StdCurd.vue:103
#: src/components/StdDataDisplay/StdCurd.vue:88
#: src/components/StdDataDisplay/StdTable.vue:112
#: src/components/StdDataDisplay/StdTable.vue:94
#: src/views/config/ConfigEdit.vue:22 src/views/domain/DomainEdit.vue:44
Expand Down
18 changes: 14 additions & 4 deletions frontend/src/language/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ msgstr ""
msgid "Action"
msgstr ""

#: src/components/StdDataDisplay/StdCurd.vue:113
#: src/components/StdDataDisplay/StdCurd.vue:123
#: src/components/StdDataDisplay/StdCurd.vue:24
msgid "Add"
msgstr ""
Expand Down Expand Up @@ -249,6 +249,10 @@ msgstr ""
msgid "Failed to enable %{msg}"
msgstr ""

#: src/language/constants.ts:9
msgid "Failed to get certificate information"
msgstr ""

#: src/views/other/Error.vue:3
#: src/views/other/Error.vue:4
msgid "File Not Found"
Expand Down Expand Up @@ -433,6 +437,14 @@ msgstr ""
msgid "Please input your username!"
msgstr ""

#: src/language/constants.ts:7
msgid "Prohibit changing root password in demo"
msgstr ""

#: src/language/constants.ts:8
msgid "Prohibit deleting the default user"
msgstr ""

#: src/views/other/About.vue:19
msgid "Project Team"
msgstr ""
Expand Down Expand Up @@ -466,7 +478,7 @@ msgstr ""
msgid "Save error %{msg}"
msgstr ""

#: src/components/StdDataDisplay/StdCurd.vue:82
#: src/components/StdDataDisplay/StdCurd.vue:91
msgid "Save Successfully"
msgstr ""

Expand All @@ -481,8 +493,6 @@ msgstr ""
msgid "Send"
msgstr ""

#: src/components/StdDataDisplay/StdCurd.vue:103
#: src/components/StdDataDisplay/StdCurd.vue:88
#: src/components/StdDataDisplay/StdTable.vue:112
#: src/components/StdDataDisplay/StdTable.vue:94
#: src/views/config/ConfigEdit.vue:22
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/language/translations.json

Large diffs are not rendered by default.

Binary file modified frontend/src/language/zh_CN/app.mo
Binary file not shown.
18 changes: 14 additions & 4 deletions frontend/src/language/zh_CN/app.po
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ msgstr "关于"
msgid "Action"
msgstr "操作"

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

#: src/language/constants.ts:9
msgid "Failed to get certificate information"
msgstr "获取证书信息失败"

#: src/views/other/Error.vue:3 src/views/other/Error.vue:4
msgid "File Not Found"
msgstr "未找到文件"
Expand Down Expand Up @@ -428,6 +432,14 @@ msgstr "请输入您的密码!"
msgid "Please input your username!"
msgstr "请输入您的用户名!"

#: src/language/constants.ts:7
msgid "Prohibit changing root password in demo"
msgstr "禁止在演示模式下修改 root 账户的密码"

#: src/language/constants.ts:8
msgid "Prohibit deleting the default user"
msgstr "禁止删除默认用户"

#: src/views/other/About.vue:19
msgid "Project Team"
msgstr "项目团队"
Expand Down Expand Up @@ -458,7 +470,7 @@ msgstr "保存指令"
msgid "Save error %{msg}"
msgstr "保存错误 %{msg}"

#: src/components/StdDataDisplay/StdCurd.vue:82
#: src/components/StdDataDisplay/StdCurd.vue:91
msgid "Save Successfully"
msgstr "保存成功"

Expand All @@ -471,8 +483,6 @@ msgstr "保存成功"
msgid "Send"
msgstr "上传"

#: src/components/StdDataDisplay/StdCurd.vue:103
#: src/components/StdDataDisplay/StdCurd.vue:88
#: src/components/StdDataDisplay/StdTable.vue:112
#: src/components/StdDataDisplay/StdTable.vue:94
#: src/views/config/ConfigEdit.vue:22 src/views/domain/DomainEdit.vue:44
Expand Down
18 changes: 14 additions & 4 deletions frontend/src/language/zh_TW/app.po
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ msgstr "關於"
msgid "Action"
msgstr "操作"

#: src/components/StdDataDisplay/StdCurd.vue:113
#: src/components/StdDataDisplay/StdCurd.vue:123
#: src/components/StdDataDisplay/StdCurd.vue:24
msgid "Add"
msgstr ""
Expand Down Expand Up @@ -252,6 +252,10 @@ msgstr "禁用失敗 %{msg}"
msgid "Failed to enable %{msg}"
msgstr "啟用失敗 %{msg}"

#: src/language/constants.ts:9
msgid "Failed to get certificate information"
msgstr ""

#: src/views/other/Error.vue:3 src/views/other/Error.vue:4
msgid "File Not Found"
msgstr "未找到檔案"
Expand Down Expand Up @@ -436,6 +440,14 @@ msgstr "請輸入您的密碼!"
msgid "Please input your username!"
msgstr "請輸入您的使用者名稱!"

#: src/language/constants.ts:7
msgid "Prohibit changing root password in demo"
msgstr ""

#: src/language/constants.ts:8
msgid "Prohibit deleting the default user"
msgstr ""

#: src/views/other/About.vue:19
msgid "Project Team"
msgstr "專案團隊"
Expand Down Expand Up @@ -466,7 +478,7 @@ msgstr "儲存指令"
msgid "Save error %{msg}"
msgstr "儲存錯誤 %{msg}"

#: src/components/StdDataDisplay/StdCurd.vue:82
#: src/components/StdDataDisplay/StdCurd.vue:91
#, fuzzy
msgid "Save Successfully"
msgstr "儲存成功"
Expand All @@ -480,8 +492,6 @@ msgstr "儲存成功"
msgid "Send"
msgstr "上傳"

#: src/components/StdDataDisplay/StdCurd.vue:103
#: src/components/StdDataDisplay/StdCurd.vue:88
#: src/components/StdDataDisplay/StdTable.vue:112
#: src/components/StdDataDisplay/StdTable.vue:94
#: src/views/config/ConfigEdit.vue:22 src/views/domain/DomainEdit.vue:44
Expand Down
3 changes: 2 additions & 1 deletion server/api/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ func CertInfo(c *gin.Context) {

if err != nil {
c.JSON(http.StatusOK, gin.H{
"error": err,
"message": "Failed to get cert information",
"error": err,
})
return
}
Expand Down
Loading

0 comments on commit c747390

Please sign in to comment.