We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents aec3cbc + b6e07d9 commit 113b444Copy full SHA for 113b444
src/utils/translations.ts
@@ -1,10 +1,17 @@
1
import type { Lang } from "./languages"
2
import type { Direction } from "../types"
3
4
+import i18nConfigs from "../../i18n/config.json"
5
+
6
export type TranslationKey = string
7
8
export const isLangRightToLeft = (lang: Lang): boolean => {
- return lang === "ar" || lang === "fa"
9
+ const langConfig = i18nConfigs.filter((language) => language.code === lang)
10
11
+ if (!langConfig.length)
12
+ throw new Error("Language code not found in isLangRightToLeft")
13
14
+ return langConfig[0].langDir === "rtl"
15
}
16
17
export const getDirection = (lang?: Lang): Direction => {
0 commit comments