Skip to content

Commit a9bc272

Browse files
davidjumaniyadvr
andcommitted
config: fix translation key usage for API actions and elsewhere (apache#407)
- Adds API messages - Fixes English strings to use keys - Fixes/adds missing keys to en.json - Fixes locale load/store issue across logout/login FIxes apache#410 Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> Co-authored-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 1edfce8 commit a9bc272

108 files changed

Lines changed: 492 additions & 306 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ui/src/components/header/HeaderNotice.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
<a-spin :spinning="loading">
2828
<a-list style="min-width: 200px; max-width: 300px">
2929
<a-list-item>
30-
<a-list-item-meta title="Notifications">
30+
<a-list-item-meta :title="$t('label.notifications')">
3131
<a-avatar :style="{backgroundColor: '#6887d0', verticalAlign: 'middle'}" icon="notification" slot="avatar"/>
32-
<a-button size="small" slot="description" @click="clearJobs">Clear All</a-button>
32+
<a-button size="small" slot="description" @click="clearJobs">{{ $t('label.clear.list') }}</a-button>
3333
</a-list-item-meta>
3434
</a-list-item>
3535
<a-list-item v-for="(job, index) in jobs" :key="index">

ui/src/components/header/TranslationMenu.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ export default {
9393
hi
9494
}
9595
},
96+
mounted () {
97+
this.language = Vue.ls.get('LOCALE') || 'en'
98+
this.setLocale(this.language)
99+
},
96100
methods: {
97101
moment,
98102
onClick (e) {
@@ -107,7 +111,7 @@ export default {
107111
this.$i18n.locale = localeValue
108112
this.language = localeValue
109113
moment.locale(localeValue)
110-
Vue.ls.set('current_locale', localeValue)
114+
Vue.ls.set('LOCALE', localeValue)
111115
}
112116
}
113117
}

ui/src/components/header/UserMenu.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@
2929
<a-menu-item class="user-menu-item" key="0">
3030
<router-link :to="{ path: '/accountuser/' + $store.getters.userInfo.id }">
3131
<a-icon class="user-menu-item-icon" type="user"/>
32-
<span class="user-menu-item-name">Profile</span>
32+
<span class="user-menu-item-name">{{ $t('label.profilename') }}</span>
3333
</router-link>
3434
</a-menu-item>
3535
<a-menu-item class="user-menu-item" key="1" disabled>
3636
<a :href="docBase" target="_blank">
3737
<a-icon class="user-menu-item-icon" type="question-circle-o"></a-icon>
38-
<span class="user-menu-item-name">Help</span>
38+
<span class="user-menu-item-name">{{ $t('label.help') }}</span>
3939
</a>
4040
</a-menu-item>
4141
<a-menu-divider/>
4242
<a-menu-item class="user-menu-item" key="2">
4343
<a href="javascript:;" @click="handleLogout">
4444
<a-icon class="user-menu-item-icon" type="logout"/>
45-
<span class="user-menu-item-name">Logout</span>
45+
<span class="user-menu-item-name">{{ $t('label.logout') }}</span>
4646
</a>
4747
</a-menu-item>
4848
</a-menu>

ui/src/components/view/DedicateData.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,12 @@ export default {
169169
}).then(response => {
170170
this.$pollJob({
171171
jobId: response.releasededicatedzoneresponse.jobid,
172-
successMessage: `Successfully released dedicated zone`,
172+
successMessage: this.$t('message.dedicated.zone.released'),
173173
successMethod: () => {
174174
this.parentFetchData()
175175
this.dedicatedDomainId = null
176176
this.$store.dispatch('AddAsyncJob', {
177-
title: 'Successfully released dedicated zone',
177+
title: this.$t('message.dedicated.zone.released'),
178178
jobid: response.releasededicatedzoneresponse.jobid,
179179
status: 'progress'
180180
})
@@ -183,7 +183,7 @@ export default {
183183
errorMethod: () => {
184184
this.parentFetchData()
185185
},
186-
loadingMessage: `Releasing dedicated zone...`,
186+
loadingMessage: this.$t('message.releasing.dedicated.zone'),
187187
catchMessage: 'Error encountered while fetching async job result',
188188
catchMethod: () => {
189189
this.parentFetchData()
@@ -199,12 +199,12 @@ export default {
199199
}).then(response => {
200200
this.$pollJob({
201201
jobId: response.releasededicatedpodresponse.jobid,
202-
successMessage: `Successfully released dedicated pod`,
202+
successMessage: this.$t('message.pod.dedication.released'),
203203
successMethod: () => {
204204
this.parentFetchData()
205205
this.dedicatedDomainId = null
206206
this.$store.dispatch('AddAsyncJob', {
207-
title: 'Successfully released dedicated pod',
207+
title: this.$t('message.pod.dedication.released'),
208208
jobid: response.releasededicatedpodresponse.jobid,
209209
status: 'progress'
210210
})
@@ -213,7 +213,7 @@ export default {
213213
errorMethod: () => {
214214
this.parentFetchData()
215215
},
216-
loadingMessage: `Releasing dedicated pod...`,
216+
loadingMessage: this.$t('message.releasing.dedicated.pod'),
217217
catchMessage: 'Error encountered while fetching async job result',
218218
catchMethod: () => {
219219
this.parentFetchData()
@@ -229,12 +229,12 @@ export default {
229229
}).then(response => {
230230
this.$pollJob({
231231
jobId: response.releasededicatedclusterresponse.jobid,
232-
successMessage: `Successfully released dedicated cluster`,
232+
successMessage: this.$t('message.cluster.dedication.released'),
233233
successMethod: () => {
234234
this.parentFetchData()
235235
this.dedicatedDomainId = null
236236
this.$store.dispatch('AddAsyncJob', {
237-
title: 'Successfully released dedicated cluster',
237+
title: this.$t('message.cluster.dedication.released'),
238238
jobid: response.releasededicatedclusterresponse.jobid,
239239
status: 'progress'
240240
})
@@ -243,7 +243,7 @@ export default {
243243
errorMethod: () => {
244244
this.parentFetchData()
245245
},
246-
loadingMessage: `Releasing dedicated cluster...`,
246+
loadingMessage: this.$t('message.releasing.dedicated.cluster'),
247247
catchMessage: 'Error encountered while fetching async job result',
248248
catchMethod: () => {
249249
this.parentFetchData()
@@ -259,12 +259,12 @@ export default {
259259
}).then(response => {
260260
this.$pollJob({
261261
jobId: response.releasededicatedhostresponse.jobid,
262-
successMessage: `Successfully released dedicated host`,
262+
successMessage: this.$t('message.host.dedication.released'),
263263
successMethod: () => {
264264
this.parentFetchData()
265265
this.dedicatedDomainId = null
266266
this.$store.dispatch('AddAsyncJob', {
267-
title: 'Successfully released dedicated host',
267+
title: this.$t('message.host.dedication.released'),
268268
jobid: response.releasededicatedhostresponse.jobid,
269269
status: 'progress'
270270
})
@@ -273,7 +273,7 @@ export default {
273273
errorMethod: () => {
274274
this.parentFetchData()
275275
},
276-
loadingMessage: `Releasing dedicated host...`,
276+
loadingMessage: this.$t('message.releasing.dedicated.host'),
277277
catchMessage: 'Error encountered while fetching async job result',
278278
catchMethod: () => {
279279
this.parentFetchData()

ui/src/components/view/DedicateModal.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ export default {
9090
}).then(response => {
9191
this.$pollJob({
9292
jobId: response.dedicatezoneresponse.jobid,
93-
successMessage: `Successfully dedicated zone`,
93+
successMessage: this.$t('label.zone.dedicated'),
9494
successMethod: () => {
9595
this.parentFetchData()
9696
this.fetchParentData()
9797
this.dedicatedDomainId = this.domainId
9898
this.dedicatedDomainModal = false
9999
this.$store.dispatch('AddAsyncJob', {
100-
title: 'Successfully dedicated zone',
100+
title: this.$t('label.zone.dedicated'),
101101
jobid: response.dedicatezoneresponse.jobid,
102102
description: `Domain ID: ${this.dedicatedDomainId}`,
103103
status: 'progress'
@@ -109,7 +109,7 @@ export default {
109109
this.fetchParentData()
110110
this.dedicatedDomainModal = false
111111
},
112-
loadingMessage: `Dedicating zone...`,
112+
loadingMessage: this.$t('message.dedicating.zone'),
113113
catchMessage: 'Error encountered while fetching async job result',
114114
catchMethod: () => {
115115
this.parentFetchData()
@@ -134,14 +134,14 @@ export default {
134134
}).then(response => {
135135
this.$pollJob({
136136
jobId: response.dedicatepodresponse.jobid,
137-
successMessage: `Successfully dedicated pod`,
137+
successMessage: this.$t('label.pod.dedicated'),
138138
successMethod: () => {
139139
this.parentFetchData()
140140
this.fetchParentData()
141141
this.dedicatedDomainId = this.domainId
142142
this.dedicatedDomainModal = false
143143
this.$store.dispatch('AddAsyncJob', {
144-
title: 'Successfully dedicated pod',
144+
title: this.$t('label.pod.dedicated'),
145145
jobid: response.dedicatepodresponse.jobid,
146146
description: `Domain ID: ${this.dedicatedDomainId}`,
147147
status: 'progress'
@@ -153,7 +153,7 @@ export default {
153153
this.fetchParentData()
154154
this.dedicatedDomainModal = false
155155
},
156-
loadingMessage: `Dedicating pod...`,
156+
loadingMessage: this.$t('message.dedicating.pod'),
157157
catchMessage: 'Error encountered while fetching async job result',
158158
catchMethod: () => {
159159
this.parentFetchData()
@@ -178,14 +178,14 @@ export default {
178178
}).then(response => {
179179
this.$pollJob({
180180
jobId: response.dedicateclusterresponse.jobid,
181-
successMessage: `Successfully dedicated cluster`,
181+
successMessage: this.$t('message.cluster.dedicated'),
182182
successMethod: () => {
183183
this.parentFetchData()
184184
this.fetchParentData()
185185
this.dedicatedDomainId = this.domainId
186186
this.dedicatedDomainModal = false
187187
this.$store.dispatch('AddAsyncJob', {
188-
title: 'Successfully dedicated cluster',
188+
title: this.$t('message.cluster.dedicated'),
189189
jobid: response.dedicateclusterresponse.jobid,
190190
description: `Domain ID: ${this.dedicatedDomainId}`,
191191
status: 'progress'
@@ -197,7 +197,7 @@ export default {
197197
this.fetchParentData()
198198
this.dedicatedDomainModal = false
199199
},
200-
loadingMessage: `Dedicating cluster...`,
200+
loadingMessage: this.$t('message.dedicating.cluster'),
201201
catchMessage: 'Error encountered while fetching async job result',
202202
catchMethod: () => {
203203
this.parentFetchData()
@@ -222,14 +222,14 @@ export default {
222222
}).then(response => {
223223
this.$pollJob({
224224
jobId: response.dedicatehostresponse.jobid,
225-
successMessage: `Successfully dedicated host`,
225+
successMessage: this.$t('message.host.dedicated'),
226226
successMethod: () => {
227227
this.parentFetchData()
228228
this.fetchParentData()
229229
this.dedicatedDomainId = this.domainId
230230
this.dedicatedDomainModal = false
231231
this.$store.dispatch('AddAsyncJob', {
232-
title: 'Successfully dedicated host',
232+
title: this.$t('message.host.dedicated'),
233233
jobid: response.dedicatehostresponse.jobid,
234234
description: `Domain ID: ${this.dedicatedDomainId}`,
235235
status: 'progress'
@@ -241,7 +241,7 @@ export default {
241241
this.fetchParentData()
242242
this.dedicatedDomainModal = false
243243
},
244-
loadingMessage: `Dedicating host...`,
244+
loadingMessage: this.$t('message.dedicating.host'),
245245
catchMessage: 'Error encountered while fetching async job result',
246246
catchMethod: () => {
247247
this.parentFetchData()

ui/src/components/view/DetailSettings.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<a-alert
2121
v-if="disableSettings"
2222
banner
23-
message="Please stop the virtual machine to access settings" />
23+
:message="$t('message.action.settings.warning.vm.running')" />
2424
<div v-else>
2525
<div v-show="!showAddDetail">
2626
<a-button type="dashed" style="width: 100%" icon="plus" @click="showAddDetail = true">{{ $t('label.add.setting') }}</a-button>
@@ -31,14 +31,14 @@
3131
:filterOption="filterOption"
3232
:value="newKey"
3333
:dataSource="Object.keys(detailOptions)"
34-
placeholder="Name"
34+
:placeholder="$t('label.name')"
3535
@change="e => onAddInputChange(e, 'newKey')" />
3636
<a-auto-complete
3737
style="width: 100%"
3838
:filterOption="filterOption"
3939
:value="newValue"
4040
:dataSource="detailOptions[newKey]"
41-
placeholder="Value"
41+
:placeholder="$t('label.value')"
4242
@change="e => onAddInputChange(e, 'newValue')" />
4343
<a-button type="primary" style="width: 25%" icon="plus" @click="addDetail">{{ $t('label.add.setting') }}</a-button>
4444
<a-button type="dashed" style="width: 25%" icon="close" @click="showAddDetail = false">{{ $t('label.cancel') }}</a-button>

ui/src/components/view/DetailsTab.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
:dataSource="$route.meta.details">
2222
<a-list-item slot="renderItem" slot-scope="item" v-if="item in resource">
2323
<div>
24-
<strong>{{ item === 'service' ? $t('label.supportedservices') : $t('label.' + item) }}</strong>
24+
<strong>{{ item === 'service' ? $t('label.supportedservices') : $t('label.' + String(item).toLowerCase()) }}</strong>
2525
<br/>
2626
<div v-if="Array.isArray(resource[item]) && item === 'service'">
2727
<div v-for="(service, idx) in resource[item]" :key="idx">

ui/src/components/view/FormView.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<span v-if="field.type==='boolean'">
4242
<a-switch
4343
v-decorator="[field.name, {
44-
rules: [{ required: field.required, message: 'Please provide input' }]
44+
rules: [{ required: field.required, message: `${this.$t('message.error.required.input')}` }]
4545
}]"
4646
:placeholder="field.description"
4747
/>
@@ -50,7 +50,7 @@
5050
<a-select
5151
:loading="field.loading"
5252
v-decorator="[field.name, {
53-
rules: [{ required: field.required, message: 'Please select option' }]
53+
rules: [{ required: field.required, message: `${this.$t('message.error.select')}` }]
5454
}]"
5555
:placeholder="field.description"
5656

@@ -63,23 +63,23 @@
6363
<span v-else-if="field.type==='long'">
6464
<a-input-number
6565
v-decorator="[field.name, {
66-
rules: [{ required: field.required, message: 'Please enter a number' }]
66+
rules: [{ required: field.required, message: `${this.$t('message.validate.number')}` }]
6767
}]"
6868
:placeholder="field.description"
6969
/>
7070
</span>
7171
<span v-else-if="field.name==='password'">
7272
<a-input-password
7373
v-decorator="[field.name, {
74-
rules: [{ required: field.required, message: 'Please enter input' }]
74+
rules: [{ required: field.required, message: `${this.$t('message.error.required.input')}` }]
7575
}]"
7676
:placeholder="field.description"
7777
/>
7878
</span>
79-
<span v-else">
79+
<span v-else>
8080
<a-input
8181
v-decorator="[field.name, {
82-
rules: [{ required: field.required, message: 'Please enter input' }]
82+
rules: [{ required: field.required, message: `${this.$t('message.error.required.input')}` }]
8383
}]"
8484
:placeholder="field.description"
8585
/>

ui/src/components/view/InfoCard.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
icon="barcode"
106106
type="dashed"
107107
size="small"
108+
@click="$message.success('Copied to clipboard')"
108109
v-clipboard:copy="resource.id" />
109110
</a-tooltip>
110111
<span style="margin-left: 10px;">{{ resource.id }}</span>
@@ -498,13 +499,13 @@
498499
<template slot="title">
499500
<span>Copy {{ $t('label.apikey') }}</span>
500501
</template>
501-
<a-button shape="circle" type="dashed" size="small" v-clipboard:copy="resource.apikey">
502+
<a-button shape="circle" type="dashed" size="small" @click="$message.success('Copied to clipboard')" v-clipboard:copy="resource.apikey">
502503
<a-icon type="copy"/>
503504
</a-button>
504505
</a-tooltip>
505506
</strong>
506507
<div>
507-
{{ resource.apikey }}
508+
{{ resource.apikey.substring(0, 20) }}...
508509
</div>
509510
</div> <br/>
510511
<div class="user-keys">
@@ -515,13 +516,13 @@
515516
<template slot="title">
516517
<span>Copy {{ $t('label.secretkey') }}</span>
517518
</template>
518-
<a-button shape="circle" type="dashed" size="small" v-clipboard:copy="resource.secretkey">
519+
<a-button shape="circle" type="dashed" size="small" @click="$message.success('Copied to clipboard')" v-clipboard:copy="resource.secretkey">
519520
<a-icon type="copy"/>
520521
</a-button>
521522
</a-tooltip>
522523
</strong>
523524
<div>
524-
{{ resource.secretkey }}
525+
{{ resource.secretkey.substring(0, 20) }}...
525526
</div>
526527
</div>
527528
</div>

0 commit comments

Comments
 (0)