Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isLangRightToLeft function not using language config setting #10259

Merged
merged 3 commits into from
May 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/utils/translations.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import type { Lang } from "./languages"
import type { Direction } from "../types"

import i18nConfigs from "../../i18n/config.json"

export type TranslationKey = string

export const isLangRightToLeft = (lang: Lang): boolean => {
return lang === "ar" || lang === "fa"
const langConfig = i18nConfigs.filter((language) => language.code === lang)

if (!langConfig.length)
throw new Error("Language code not found in isLangRightToLeft")

return langConfig[0].langDir === "rtl"
}

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