Add RTL support

This commit is contained in:
root
2022-02-09 11:21:31 +05:30
parent 8982c644c6
commit 2cf34482a6
3 changed files with 24 additions and 8 deletions
+11 -6
View File
@@ -172,12 +172,6 @@ export default {
}
},
watch: {
'$store.state.prefs.prefs.darkMode' (newVal) {
this.$vuetify.theme.dark = newVal
}
},
methods: {
changeLocale (lang) {
return changeLocale(lang)
@@ -192,9 +186,20 @@ export default {
}
},
watch: {
'$store.state.prefs.prefs.darkMode' (newVal) {
this.$vuetify.theme.dark = newVal
},
'$store.state.i18n.rtl' (newVal) {
this.$vuetify.rtl = newVal
}
},
created () {
this.$store.dispatch('prefs/loadState')
this.$store.dispatch('auth/initializeAuth')
this.$vuetify.rtl = this.$store.state.i18n.rtl
}
}
</script>
+1
View File
@@ -31,6 +31,7 @@ export const COUNTRY_I18N_EXCEPTIONS = {
'zh-Hans': 'zh'
}
// Similar switches for RTL can be found in the i18n store
async function syncStylesPerLanguage (locale) {
switch (locale) {
// All the latin languages
+12 -2
View File
@@ -4,7 +4,8 @@ export const i18nStore = {
fullFormatter: null,
dateFormatter: null,
NF: null,
timeAgo: null
timeAgo: null,
rtl: false
}),
mutations: {
@@ -17,8 +18,17 @@ export const i18nStore = {
dateStyle: 'long'
})
state.NF = new Intl.NumberFormat(window.localStorage.getItem('NF_OVERRIDE') || intlLocale)
state.timeAgo = timeAgo
switch (intlLocale) {
case 'ar':
case 'ckb':
state.rtl = true
break
default:
state.rtl = false
break
}
}
},