From 008097f0cc2cfaf4fd6c1560b140cc4495eae6ea Mon Sep 17 00:00:00 2001 From: Nicolas Vazquez Date: Mon, 6 Jul 2020 05:22:50 -0300 Subject: [PATCH] state: Internationalize VM state output (#493) CloudStack API methods return resources states in English, switching Primate to a different language should also translate these states. Signed-off-by: Rohit Yadav --- ui/src/components/widgets/Status.vue | 32 +++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/ui/src/components/widgets/Status.vue b/ui/src/components/widgets/Status.vue index db2d63d7bd5..15977876922 100644 --- a/ui/src/components/widgets/Status.vue +++ b/ui/src/components/widgets/Status.vue @@ -38,7 +38,37 @@ export default { methods: { getText () { if (this.displayText && this.text) { - return this.text.charAt(0).toUpperCase() + this.text.slice(1) + var state = this.text + switch (state) { + case 'Running': + state = this.$t('state.running') + break + case 'Stopped': + state = this.$t('state.stopped') + break + case 'Starting': + state = this.$t('state.starting') + break + case 'Stopping': + state = this.$t('state.stopping') + break + case 'Suspended': + state = this.$t('state.suspended') + break + case 'Pending': + state = this.$t('state.pending') + break + case 'Migrating': + state = this.$t('state.migrating') + break + case 'Expunging': + state = this.$t('state.expunging') + break + case 'Error': + state = this.$t('state.error') + break + } + return state.charAt(0).toUpperCase() + state.slice(1) } return '' },