Skip to content

Commit 032b03e

Browse files
Anurag Awasthiyadvr
authored andcommitted
Added some fixes and made language change not reload (#31)
* Added some fixes and made language change not reload * Remove unwanted code Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 7b2c84d commit 032b03e

File tree

13 files changed

+24
-27
lines changed

13 files changed

+24
-27
lines changed

ui/src/components/CloudMonkey/Resource.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ export default {
279279
if (to.fullPath !== from.fullPath) {
280280
this.fetchData()
281281
}
282+
},
283+
'$i18n.locale' (to, from) {
284+
if (to !== from) {
285+
this.fetchData()
286+
}
282287
}
283288
},
284289
beforeCreate () {
@@ -289,9 +294,6 @@ export default {
289294
this.breadList = []
290295
this.name = this.$route.name
291296
this.$route.matched.forEach((item) => {
292-
if (item.meta.title) {
293-
item.meta.title = this.$t(item.meta.title)
294-
}
295297
this.breadList.push(item)
296298
})
297299
},
@@ -319,8 +321,6 @@ export default {
319321
} else {
320322
this.dataView = false
321323
}
322-
console.log(this.$route)
323-
console.log(this.routeName)
324324
if (this.$route && this.$route.meta && this.$route.meta.permission) {
325325
this.apiName = this.$route.meta.permission[0]
326326
if (this.$route.meta.columns) {

ui/src/components/layouts/PageView.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div :style="!$route.meta.hiddenHeaderContent ? 'margin: -24px -24px 0px;' : null">
33
<div class="page-menu-tabs">
44
<a-tabs :tabBarStyle="{margin: 0}" @change="changeTab">
5-
<a-tab-pane v-for="child in $route.permission" :tab="child.meta.title" :key="child.key"></a-tab-pane>
5+
<a-tab-pane v-for="child in $route.permission" :tab="this.$t(child.meta.title)" :key="child.key"></a-tab-pane>
66
</a-tabs>
77
</div>
88
<div class="content">
@@ -71,7 +71,7 @@ export default {
7171
},
7272
getPageMeta () {
7373
// eslint-disable-next-line
74-
this.pageTitle = (typeof(this.title) === 'string' || !this.title) ? this.title : this.$route.meta.title
74+
this.pageTitle = (typeof(this.title) === 'string' || !this.title) ? this.$t(this.title) : this.$t(this.$route.meta.title)
7575
7676
const content = this.$refs.content
7777
if (content) {

ui/src/components/menu/menu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export default {
121121
<SubMenu {...{ key: menu.path }}>
122122
<span slot="title">
123123
{this.renderIcon(menu.meta.icon)}
124-
<span>{menu.meta.title}</span>
124+
<span>{this.$t(menu.meta.title)}</span>
125125
</span>
126126
{itemArr}
127127
</SubMenu>

ui/src/components/tools/Breadcrumb.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<a-breadcrumb class="breadcrumb">
33
<a-breadcrumb-item v-for="(item, index) in breadList" :key="index">
44
<router-link v-if="item.name != name" :to="{ path: item.path }">
5-
{{ item.meta.title }}
5+
{{ this.$t(item.meta.title) }}
66
</router-link>
7-
<span v-else>{{ item.meta.title }}</span>
7+
<span v-else>{{ this.$t(item.meta.title) }}</span>
88
</a-breadcrumb-item>
99
</a-breadcrumb>
1010
</template>

ui/src/components/tools/TranslationMenu.vue

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ export default {
5959
},
6060
data () {
6161
return {
62-
locale: null,
6362
enUS,
6463
arEG,
6564
caES,
@@ -81,16 +80,14 @@ export default {
8180
methods: {
8281
moment,
8382
onClick (e) {
84-
const localeValue = e.key
85-
this.locale = localeValue
83+
var localeValue = e.key
8684
if (!localeValue) {
87-
moment.locale('en')
88-
} else {
89-
moment.locale(localeValue)
90-
this.$i18n.locale = e.key
91-
Vue.ls.set('current_locale', e.key)
92-
this.$router.go(0)
85+
localeValue = 'en'
9386
}
87+
this.$locale = localeValue
88+
moment.locale(localeValue)
89+
this.$i18n.locale = localeValue
90+
Vue.ls.set('current_locale', localeValue)
9491
}
9592
}
9693
}

ui/src/locales/ar.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
"esplifetime": "\u0639\u0645\u0631 ESP (\u062b\u0627\u0646\u064a\u0629)",
186186
"esppolicy": "\u0633\u064a\u0627\u0633\u0629 ESP",
187187
"expunge": "Expunge",
188-
"fingerprint": "FingerPrint",
188+
"fingerprint": "Finger Print",
189189
"firstname": "First Name",
190190
"forced": "Force Stop",
191191
"forceencap": "Force UDP Encapsulation of ESP Packets",

ui/src/locales/ca.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
"esplifetime": "ESP Lifetime (second)",
186186
"esppolicy": "ESP policy",
187187
"expunge": "Expunge",
188-
"fingerprint": "FingerPrint",
188+
"fingerprint": "Finger Print",
189189
"firstname": "First Name",
190190
"forced": "Force Stop",
191191
"forceencap": "Force UDP Encapsulation of ESP Packets",

ui/src/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
"expunge": "Expunge",
195195
"externalId": "External Id",
196196
"extra": "Extra Arguments",
197-
"fingerprint": "FingerPrint",
197+
"fingerprint": "Finger Print",
198198
"firstname": "First Name",
199199
"forced": "Force Stop",
200200
"forceencap": "Force UDP Encapsulation of ESP Packets",

ui/src/locales/it_IT.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
"esplifetime": "ESP Lifetime (second)",
186186
"esppolicy": "Policy di ESP",
187187
"expunge": "Expunge",
188-
"fingerprint": "FingerPrint",
188+
"fingerprint": "Finger Print",
189189
"firstname": "Nome",
190190
"forced": "Forza l'Arresto",
191191
"forceencap": "Force UDP Encapsulation of ESP Packets",

ui/src/locales/ko_KR.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
"esplifetime": "ESP \uc720\ud6a8\uae30\uac04(\ucd08)",
186186
"esppolicy": "ESP \uc815\ucc45",
187187
"expunge": "Expunge",
188-
"fingerprint": "FingerPrint",
188+
"fingerprint": "Finger Print",
189189
"firstname": "\uc774\ub984",
190190
"forced": "\uac15\uc81c \uc815\uc9c0",
191191
"forceencap": "Force UDP Encapsulation of ESP Packets",

0 commit comments

Comments
 (0)