feat: add rtl support (#2178)

This commit is contained in:
thewh1teagle
2022-10-21 19:07:11 +03:00
committed by GitHub
parent a49105db1d
commit 2c14146a31
10 changed files with 152 additions and 1 deletions

View File

@@ -13,7 +13,7 @@ import Shares from "@/views/settings/Shares";
import Errors from "@/views/Errors";
import store from "@/store";
import { baseURL, name } from "@/utils/constants";
import i18n from "@/i18n";
import i18n, { rtlLanguages } from "@/i18n";
Vue.use(Router);
@@ -158,6 +158,18 @@ router.beforeEach((to, from, next) => {
const title = i18n.t(titles[to.name]);
document.title = title + " - " + name;
/*** RTL related settings per route ****/
const rtlSet = document.querySelector("body").classList.contains("rtl");
const shouldSetRtl = rtlLanguages.includes(i18n.locale);
switch (true) {
case shouldSetRtl && !rtlSet:
document.querySelector("body").classList.add("rtl");
break;
case !shouldSetRtl && rtlSet:
document.querySelector("body").classList.remove("rtl");
break;
}
if (to.matched.some((record) => record.meta.requiresAuth)) {
if (!store.getters.isLogged) {
next({