From 7119b6ceabe62c3fcec99e52c139d15a573f51bd Mon Sep 17 00:00:00 2001 From: OriginalAuthority Date: Sun, 2 Jun 2024 16:17:11 +0100 Subject: [PATCH] Check if this is a right to left language --- getTranslations.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/getTranslations.php b/getTranslations.php index 02932cb..7cd7d13 100644 --- a/getTranslations.php +++ b/getTranslations.php @@ -92,4 +92,29 @@ function getDefault() { return json_decode( file_get_contents( __DIR__ . '/i18n/en.json' ), true ); } +/** + * Is the current language a right-to-left language? + * + * @return bool - true if so, false if not + */ +function isRightToLeft() { + $langCode = getLanguageCode(); + $rtlLanguages = [ + 'ar', + 'arc', + 'dv', + 'fa', + 'ha', + 'he', + 'khw', + 'ks', + 'ku', + 'ps', + 'ur', + 'yi' + ]; + + return in_array($langCode, $rtlLanguages); +} + ?>