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>
This commit is contained in:
Anurag Awasthi 2019-09-02 01:15:48 +05:30 committed by Rohit Yadav
parent 7b2c84de8c
commit 032b03ec15
13 changed files with 24 additions and 27 deletions

View File

@ -279,6 +279,11 @@ export default {
if (to.fullPath !== from.fullPath) { if (to.fullPath !== from.fullPath) {
this.fetchData() this.fetchData()
} }
},
'$i18n.locale' (to, from) {
if (to !== from) {
this.fetchData()
}
} }
}, },
beforeCreate () { beforeCreate () {
@ -289,9 +294,6 @@ export default {
this.breadList = [] this.breadList = []
this.name = this.$route.name this.name = this.$route.name
this.$route.matched.forEach((item) => { this.$route.matched.forEach((item) => {
if (item.meta.title) {
item.meta.title = this.$t(item.meta.title)
}
this.breadList.push(item) this.breadList.push(item)
}) })
}, },
@ -319,8 +321,6 @@ export default {
} else { } else {
this.dataView = false this.dataView = false
} }
console.log(this.$route)
console.log(this.routeName)
if (this.$route && this.$route.meta && this.$route.meta.permission) { if (this.$route && this.$route.meta && this.$route.meta.permission) {
this.apiName = this.$route.meta.permission[0] this.apiName = this.$route.meta.permission[0]
if (this.$route.meta.columns) { if (this.$route.meta.columns) {

View File

@ -2,7 +2,7 @@
<div :style="!$route.meta.hiddenHeaderContent ? 'margin: -24px -24px 0px;' : null"> <div :style="!$route.meta.hiddenHeaderContent ? 'margin: -24px -24px 0px;' : null">
<div class="page-menu-tabs"> <div class="page-menu-tabs">
<a-tabs :tabBarStyle="{margin: 0}" @change="changeTab"> <a-tabs :tabBarStyle="{margin: 0}" @change="changeTab">
<a-tab-pane v-for="child in $route.permission" :tab="child.meta.title" :key="child.key"></a-tab-pane> <a-tab-pane v-for="child in $route.permission" :tab="this.$t(child.meta.title)" :key="child.key"></a-tab-pane>
</a-tabs> </a-tabs>
</div> </div>
<div class="content"> <div class="content">
@ -71,7 +71,7 @@ export default {
}, },
getPageMeta () { getPageMeta () {
// eslint-disable-next-line // eslint-disable-next-line
this.pageTitle = (typeof(this.title) === 'string' || !this.title) ? this.title : this.$route.meta.title this.pageTitle = (typeof(this.title) === 'string' || !this.title) ? this.$t(this.title) : this.$t(this.$route.meta.title)
const content = this.$refs.content const content = this.$refs.content
if (content) { if (content) {

View File

@ -121,7 +121,7 @@ export default {
<SubMenu {...{ key: menu.path }}> <SubMenu {...{ key: menu.path }}>
<span slot="title"> <span slot="title">
{this.renderIcon(menu.meta.icon)} {this.renderIcon(menu.meta.icon)}
<span>{menu.meta.title}</span> <span>{this.$t(menu.meta.title)}</span>
</span> </span>
{itemArr} {itemArr}
</SubMenu> </SubMenu>

View File

@ -2,9 +2,9 @@
<a-breadcrumb class="breadcrumb"> <a-breadcrumb class="breadcrumb">
<a-breadcrumb-item v-for="(item, index) in breadList" :key="index"> <a-breadcrumb-item v-for="(item, index) in breadList" :key="index">
<router-link v-if="item.name != name" :to="{ path: item.path }"> <router-link v-if="item.name != name" :to="{ path: item.path }">
{{ item.meta.title }} {{ this.$t(item.meta.title) }}
</router-link> </router-link>
<span v-else>{{ item.meta.title }}</span> <span v-else>{{ this.$t(item.meta.title) }}</span>
</a-breadcrumb-item> </a-breadcrumb-item>
</a-breadcrumb> </a-breadcrumb>
</template> </template>

View File

@ -59,7 +59,6 @@ export default {
}, },
data () { data () {
return { return {
locale: null,
enUS, enUS,
arEG, arEG,
caES, caES,
@ -81,16 +80,14 @@ export default {
methods: { methods: {
moment, moment,
onClick (e) { onClick (e) {
const localeValue = e.key var localeValue = e.key
this.locale = localeValue
if (!localeValue) { if (!localeValue) {
moment.locale('en') localeValue = 'en'
} else {
moment.locale(localeValue)
this.$i18n.locale = e.key
Vue.ls.set('current_locale', e.key)
this.$router.go(0)
} }
this.$locale = localeValue
moment.locale(localeValue)
this.$i18n.locale = localeValue
Vue.ls.set('current_locale', localeValue)
} }
} }
} }

View File

@ -185,7 +185,7 @@
"esplifetime": "\u0639\u0645\u0631 ESP (\u062b\u0627\u0646\u064a\u0629)", "esplifetime": "\u0639\u0645\u0631 ESP (\u062b\u0627\u0646\u064a\u0629)",
"esppolicy": "\u0633\u064a\u0627\u0633\u0629 ESP", "esppolicy": "\u0633\u064a\u0627\u0633\u0629 ESP",
"expunge": "Expunge", "expunge": "Expunge",
"fingerprint": "FingerPrint", "fingerprint": "Finger Print",
"firstname": "First Name", "firstname": "First Name",
"forced": "Force Stop", "forced": "Force Stop",
"forceencap": "Force UDP Encapsulation of ESP Packets", "forceencap": "Force UDP Encapsulation of ESP Packets",

View File

@ -185,7 +185,7 @@
"esplifetime": "ESP Lifetime (second)", "esplifetime": "ESP Lifetime (second)",
"esppolicy": "ESP policy", "esppolicy": "ESP policy",
"expunge": "Expunge", "expunge": "Expunge",
"fingerprint": "FingerPrint", "fingerprint": "Finger Print",
"firstname": "First Name", "firstname": "First Name",
"forced": "Force Stop", "forced": "Force Stop",
"forceencap": "Force UDP Encapsulation of ESP Packets", "forceencap": "Force UDP Encapsulation of ESP Packets",

View File

@ -194,7 +194,7 @@
"expunge": "Expunge", "expunge": "Expunge",
"externalId": "External Id", "externalId": "External Id",
"extra": "Extra Arguments", "extra": "Extra Arguments",
"fingerprint": "FingerPrint", "fingerprint": "Finger Print",
"firstname": "First Name", "firstname": "First Name",
"forced": "Force Stop", "forced": "Force Stop",
"forceencap": "Force UDP Encapsulation of ESP Packets", "forceencap": "Force UDP Encapsulation of ESP Packets",

View File

@ -185,7 +185,7 @@
"esplifetime": "ESP Lifetime (second)", "esplifetime": "ESP Lifetime (second)",
"esppolicy": "Policy di ESP", "esppolicy": "Policy di ESP",
"expunge": "Expunge", "expunge": "Expunge",
"fingerprint": "FingerPrint", "fingerprint": "Finger Print",
"firstname": "Nome", "firstname": "Nome",
"forced": "Forza l'Arresto", "forced": "Forza l'Arresto",
"forceencap": "Force UDP Encapsulation of ESP Packets", "forceencap": "Force UDP Encapsulation of ESP Packets",

View File

@ -185,7 +185,7 @@
"esplifetime": "ESP \uc720\ud6a8\uae30\uac04(\ucd08)", "esplifetime": "ESP \uc720\ud6a8\uae30\uac04(\ucd08)",
"esppolicy": "ESP \uc815\ucc45", "esppolicy": "ESP \uc815\ucc45",
"expunge": "Expunge", "expunge": "Expunge",
"fingerprint": "FingerPrint", "fingerprint": "Finger Print",
"firstname": "\uc774\ub984", "firstname": "\uc774\ub984",
"forced": "\uac15\uc81c \uc815\uc9c0", "forced": "\uac15\uc81c \uc815\uc9c0",
"forceencap": "Force UDP Encapsulation of ESP Packets", "forceencap": "Force UDP Encapsulation of ESP Packets",

View File

@ -185,7 +185,7 @@
"esplifetime": "ESP levetid (sekund)", "esplifetime": "ESP levetid (sekund)",
"esppolicy": "ESP policy", "esppolicy": "ESP policy",
"expunge": "Permanent Slett", "expunge": "Permanent Slett",
"fingerprint": "Fingeravtrykk", "fingerprint": "Finger avtrykk",
"firstname": "Fornavn", "firstname": "Fornavn",
"forced": "Tving stopp", "forced": "Tving stopp",
"forceencap": "Tving UDP innkapsling av ESP-pakker", "forceencap": "Tving UDP innkapsling av ESP-pakker",

View File

@ -185,7 +185,7 @@
"esplifetime": "ESP Lifetime (second)", "esplifetime": "ESP Lifetime (second)",
"esppolicy": "ESP policy", "esppolicy": "ESP policy",
"expunge": "Expunge", "expunge": "Expunge",
"fingerprint": "FingerPrint", "fingerprint": "Finger Print",
"firstname": "Pierwsza nazwa", "firstname": "Pierwsza nazwa",
"forced": "Force Stop", "forced": "Force Stop",
"forceencap": "Force UDP Encapsulation of ESP Packets", "forceencap": "Force UDP Encapsulation of ESP Packets",

View File

@ -185,7 +185,7 @@
"esplifetime": "\u0412\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438 ESP (\u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445)", "esplifetime": "\u0412\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438 ESP (\u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445)",
"esppolicy": "\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 ESP", "esppolicy": "\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 ESP",
"expunge": "\u0423\u0434\u0430\u043b\u0451\u043d", "expunge": "\u0423\u0434\u0430\u043b\u0451\u043d",
"fingerprint": "FingerPrint", "fingerprint": "Finger Print",
"firstname": "\u0418\u043c\u044f", "firstname": "\u0418\u043c\u044f",
"forced": "\u041f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c", "forced": "\u041f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c",
"forceencap": "Force UDP Encapsulation of ESP Packets", "forceencap": "Force UDP Encapsulation of ESP Packets",