Skip to content

Commit 6aee978

Browse files
committed
use lang config instead of hardcode for lang direction
1 parent 8203cff commit 6aee978

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/utils/translations.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import type { Lang } from "./languages"
22
import type { Direction } from "../types"
33

4+
import i18nConfigs from "../../i18n/config.json"
5+
46
export type TranslationKey = string
57

68
export const isLangRightToLeft = (lang: Lang): boolean => {
7-
return lang === "ar" || lang === "fa"
9+
const langConfig = i18nConfigs.filter(
10+
(language) => language.hrefLang === lang
11+
)
12+
return langConfig[0].langDir === "rtl"
813
}
914

1015
export const getDirection = (lang?: Lang): Direction => {

0 commit comments

Comments
 (0)