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

View File

@ -2,7 +2,7 @@
<div :style="!$route.meta.hiddenHeaderContent ? 'margin: -24px -24px 0px;' : null">
<div class="page-menu-tabs">
<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>
</div>
<div class="content">
@ -71,7 +71,7 @@ export default {
},
getPageMeta () {
// 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
if (content) {

View File

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

View File

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

View File

@ -59,7 +59,6 @@ export default {
},
data () {
return {
locale: null,
enUS,
arEG,
caES,
@ -81,16 +80,14 @@ export default {
methods: {
moment,
onClick (e) {
const localeValue = e.key
this.locale = localeValue
var localeValue = e.key
if (!localeValue) {
moment.locale('en')
} else {
moment.locale(localeValue)
this.$i18n.locale = e.key
Vue.ls.set('current_locale', e.key)
this.$router.go(0)
localeValue = 'en'
}
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)",
"esppolicy": "\u0633\u064a\u0627\u0633\u0629 ESP",
"expunge": "Expunge",
"fingerprint": "FingerPrint",
"fingerprint": "Finger Print",
"firstname": "First Name",
"forced": "Force Stop",
"forceencap": "Force UDP Encapsulation of ESP Packets",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -185,7 +185,7 @@
"esplifetime": "ESP Lifetime (second)",
"esppolicy": "ESP policy",
"expunge": "Expunge",
"fingerprint": "FingerPrint",
"fingerprint": "Finger Print",
"firstname": "Pierwsza nazwa",
"forced": "Force Stop",
"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)",
"esppolicy": "\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 ESP",
"expunge": "\u0423\u0434\u0430\u043b\u0451\u043d",
"fingerprint": "FingerPrint",
"fingerprint": "Finger Print",
"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",
"forceencap": "Force UDP Encapsulation of ESP Packets",