UI: Fix missing locale strings for Status widget (#8792)

This commit is contained in:
Vishesh 2024-04-19 15:01:51 +05:30 committed by GitHub
parent 5f8450f28f
commit d4a5459a83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -166,23 +166,24 @@ export default {
if (!(state && this.displayText)) { if (!(state && this.displayText)) {
return '' return ''
} }
let result
if (this.$route.path === '/vmsnapshot' || this.$route.path.includes('/vmsnapshot/')) { if (this.$route.path === '/vmsnapshot' || this.$route.path.includes('/vmsnapshot/')) {
return this.$t('message.vmsnapshot.state.' + state.toLowerCase()) result = this.$t('message.vmsnapshot.state.' + state.toLowerCase())
} else if (this.$route.path === '/vm' || this.$route.path.includes('/vm/')) {
result = this.$t('message.vm.state.' + state.toLowerCase())
} else if (this.$route.path === '/volume' || this.$route.path.includes('/volume/')) {
result = this.$t('message.volume.state.' + state.toLowerCase())
} else if (this.$route.path === '/guestnetwork' || this.$route.path.includes('/guestnetwork/')) {
result = this.$t('message.guestnetwork.state.' + state.toLowerCase())
} else if (this.$route.path === '/publicip' || this.$route.path.includes('/publicip/')) {
result = this.$t('message.publicip.state.' + state.toLowerCase())
} }
if (this.$route.path === '/vm' || this.$route.path.includes('/vm/')) {
return this.$t('message.vm.state.' + state.toLowerCase()) if (!result || (result.startsWith('message.') && result.endsWith('.state.' + state.toLowerCase()))) {
// Nothing for snapshots, vpcs, gateways, vnpnconn, vpnuser, kubectl, event, project, account, infra. They're all self explanatory
result = this.$t(state)
} }
if (this.$route.path === '/volume' || this.$route.path.includes('/volume/')) { return result
return this.$t('message.volume.state.' + state.toLowerCase())
}
if (this.$route.path === '/guestnetwork' || this.$route.path.includes('/guestnetwork/')) {
return this.$t('message.guestnetwork.state.' + state.toLowerCase())
}
if (this.$route.path === '/publicip' || this.$route.path.includes('/publicip/')) {
return this.$t('message.publicip.state.' + state.toLowerCase())
}
// Nothing for snapshots, vpcs, gateways, vnpnconn, vpnuser, kubectl, event, project, account, infra. They're all self explanatory
return this.$t(state)
}, },
getStyle () { getStyle () {
let styles = { display: 'inline-flex' } let styles = { display: 'inline-flex' }