diff --git a/packages/nc-gui/components/general/language/Menu.vue b/packages/nc-gui/components/general/language/Menu.vue
index fcee33fc15..37e876179b 100644
--- a/packages/nc-gui/components/general/language/Menu.vue
+++ b/packages/nc-gui/components/general/language/Menu.vue
@@ -1,6 +1,6 @@
diff --git a/packages/nc-gui/plugins/a.i18n.ts b/packages/nc-gui/plugins/a.i18n.ts
index a0c9c2a498..88f7ea2ef1 100644
--- a/packages/nc-gui/plugins/a.i18n.ts
+++ b/packages/nc-gui/plugins/a.i18n.ts
@@ -1,5 +1,6 @@
import { createI18n } from 'vue-i18n'
-import { defineNuxtPlugin, nextTick } from '#imports'
+import { isClient } from '@vueuse/core'
+import { applyLanguageDirection, defineNuxtPlugin, nextTick } from '#imports'
import type { Language, NocoI18n } from '~/lib'
import { LanguageAlias } from '~/lib'
@@ -24,6 +25,8 @@ export async function setI18nLanguage(locale: keyof typeof Language, i18n = glob
}
i18n.global.locale.value = locale
+
+ if (isClient) applyLanguageDirection(locale)
}
export async function loadLocaleMessages(
diff --git a/packages/nc-gui/utils/viewUtils.ts b/packages/nc-gui/utils/viewUtils.ts
index 0d03c1ac14..30fbe3978d 100644
--- a/packages/nc-gui/utils/viewUtils.ts
+++ b/packages/nc-gui/utils/viewUtils.ts
@@ -7,6 +7,7 @@ import MdiCalendarIcon from '~icons/mdi/calendar'
import MdiGalleryIcon from '~icons/mdi/camera-image'
import MdiKanbanIcon from '~icons/mdi/tablet-dashboard'
import MdiEyeIcon from '~icons/mdi/eye-circle-outline'
+import type { Language } from '~/lib'
export const viewIcons: Record = {
[ViewTypes.GRID]: { icon: MdiGridIcon, color: '#8f96f2' },
@@ -23,3 +24,17 @@ export const viewTypeAlias: Record = {
[ViewTypes.GALLERY]: 'gallery',
[ViewTypes.KANBAN]: 'kanban',
}
+
+const isRtlLang = (lang: keyof typeof Language) => ['fa', 'ar'].includes(lang)
+
+const rtl = 'rtl'
+const ltr = 'ltr'
+
+export function applyLanguageDirection(lang: keyof typeof Language) {
+ const targetDirection = isRtlLang(lang) ? rtl : ltr
+ const oppositeDirection = targetDirection === ltr ? rtl : ltr
+
+ document.body.classList.remove(oppositeDirection)
+ document.body.classList.add(targetDirection)
+ document.body.style.direction = targetDirection
+}