Skip to content

Commit 113b444

Browse files
authored
Merge pull request #10259 from ethereum/isLangRightToLeftFix
isLangRightToLeft function not using language config setting
2 parents aec3cbc + b6e07d9 commit 113b444

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/utils/translations.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
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((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"
815
}
916

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

0 commit comments

Comments
 (0)