Skip to content

Commit

Permalink
perf: fix i18n warning msg
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeEirc committed Sep 17, 2024
1 parent 9a39b88 commit e78763d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions ui/src/components/GuacFileSystem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ export default {
iframe.src = url
this.$log.debug(url)
},
handleI18nStatus(status) {
let msg = status.message
if (['zh', 'zh_Hant', 'ja'].includes(getLanguage())) {
msg = this.$t(ErrorStatusCodes[status.code]) || status.message
}
return msg
},
fileDrop: function(e) {
e.stopPropagation()
Expand All @@ -192,10 +199,7 @@ export default {
this.handleFiles(files[0]).then(() => {
this.$message(files[0].name + ' ' + this.$t('UploadSuccess'))
}).catch(status => {
let msg = status.message
if (['zh-CN', 'zh-Hant'].includes(getLanguage())) {
msg = this.$t(ErrorStatusCodes[status.code]) || status.message
}
const msg = this.handleI18nStatus(status)
this.$warning(msg)
})
},
Expand Down Expand Up @@ -323,10 +327,7 @@ export default {
}).catch(err => {
fileObj.onError(err)
this.$log.debug('Upload error: ', err)
let msg = err.message
if (['zh-CN', 'zh-Hant'].includes(getLanguage())) {
msg = this.$t(ErrorStatusCodes[err.code]) || err.message
}
const msg = this.handleI18nStatus(err)
this.$warning(msg)
})
},
Expand Down

0 comments on commit e78763d

Please sign in to comment.