diff options
Diffstat (limited to 'lib/private/L10N')
-rw-r--r-- | lib/private/L10N/Factory.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index 7dd0704682d..a74781a2ed0 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -58,6 +58,12 @@ class Factory implements IFactory { 'pt_BR', 'pt_PT', 'da', 'fi_FI', 'nb_NO', 'sv', 'tr', 'zh_CN', 'ko' ]; + public const RTL_LANGUAGES = [ + 'ae', 'ar', 'arc', 'arz', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', + 'ha', 'he', 'khw', 'ks', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', + 'ur', 'uzs', 'yi', + ]; + private ICache $cache; public function __construct( @@ -364,6 +370,16 @@ class Factory implements IFactory { return in_array($lang, $languages); } + + public function getLanguageDirectionFromLocale(string $locale): string + { + if (in_array($locale, self::RTL_LANGUAGES)) { + return 'rtl'; + } + + return 'ltr'; + } + public function getLanguageIterator(?IUser $user = null): ILanguageIterator { $user = $user ?? $this->userSession->getUser(); if ($user === null) { |