Add localeDirection method to i18n.js

Add dir to html tag based on localeDirection
Add Farsi to the languages
This commit is contained in:
Soroosh
2021-09-26 01:09:00 +03:30
parent 795d5f586f
commit 251d42f1a6
3 changed files with 204 additions and 3 deletions

View File

@@ -3,5 +3,25 @@
</template>
<script>
export default {}
import { i18n, localeDirection } from "./i18n";
export default {
created() {
this.setPageLocale();
},
methods: {
setPageLocale() {
const html = document.documentElement
html.setAttribute('lang', this.$i18n.locale )
html.setAttribute('dir', localeDirection() )
}
},
watch: {
"$i18n.locale"() {
this.setPageLocale();
},
},
}
</script>