2019-09-06 13:42:29 +00:00
|
|
|
<template>
|
|
|
|
<div class="i18n">
|
|
|
|
<b-dropdown>
|
|
|
|
<template slot="button-content">
|
|
|
|
<i class="fa fa-lg fa-language" aria-hidden="true"></i>
|
|
|
|
|
|
|
|
<div class="text">
|
|
|
|
Language
|
|
|
|
<span class="caret"></span>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template slot="dropdown">
|
2019-09-11 11:52:20 +00:00
|
|
|
<b-dropdown-item v-for="lang in $language.availableLanguages" @click="changeLanguage(lang)">
|
2019-09-06 13:42:29 +00:00
|
|
|
<router-link :to="'/' + lang + '/' + ($route.path.split('/')[2] || '')">{{ locales[lang] }}</router-link>
|
|
|
|
</b-dropdown-item>
|
|
|
|
|
2019-09-11 11:52:20 +00:00
|
|
|
<b-dropdown-divider></b-dropdown-divider>
|
2019-09-06 13:42:29 +00:00
|
|
|
|
2019-09-11 11:52:20 +00:00
|
|
|
<b-dropdown-item>
|
|
|
|
<a>
|
2019-09-06 13:42:29 +00:00
|
|
|
<i class="fa fa-fw fa-plus" aria-hidden="true"></i>
|
2019-09-11 11:52:20 +00:00
|
|
|
<span v-translate>Translate</span>
|
2019-09-06 13:42:29 +00:00
|
|
|
</a>
|
|
|
|
</b-dropdown-item>
|
|
|
|
</template>
|
|
|
|
</b-dropdown>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.i18n .dropdown {
|
|
|
|
button {
|
|
|
|
height: 60px;
|
|
|
|
color: #000;
|
|
|
|
background-color: #fff;
|
|
|
|
border: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.dropdown-toggle::after {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.text {
|
|
|
|
font-size: 11px;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<script>
|
2019-09-11 11:52:20 +00:00
|
|
|
import { BDropdown, BDropdownDivider, BDropdownItem } from 'bootstrap-vue'
|
2019-09-06 13:42:29 +00:00
|
|
|
|
2019-09-11 11:52:20 +00:00
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
BDropdown, BDropdownDivider, BDropdownItem
|
|
|
|
},
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
currentComponent: '',
|
|
|
|
switchLanguage: 'en'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
changeLanguage (lang) {
|
|
|
|
this.switchLanguage = lang
|
|
|
|
this.$i18n.locale = lang
|
|
|
|
this.currentComponent = this.$route.path.split('/')[2] // eslint-disable-line prefer-destructuring
|
|
|
|
}
|
2019-09-06 13:42:29 +00:00
|
|
|
}
|
2019-09-11 11:52:20 +00:00
|
|
|
}
|
2019-09-06 13:42:29 +00:00
|
|
|
</script>
|