aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/L10N
diff options
context:
space:
mode:
authorali ghorbani <ghorbani.ali.developer@gmail.com>2023-12-15 20:30:22 +0330
committerJoas Schilling <coding@schilljs.com>2024-09-23 16:59:20 +0200
commit2b7efd66b6deb7fca62046a54b8ca0fe0310fe34 (patch)
treeace46e1cd61f0b08261468e7c0a923b640bcfbba /lib/private/L10N
parenta8ee7424ad12f923b681856b1e282905a10a081e (diff)
downloadnextcloud-server-2b7efd66b6deb7fca62046a54b8ca0fe0310fe34.tar.gz
nextcloud-server-2b7efd66b6deb7fca62046a54b8ca0fe0310fe34.zip
feat(rtl): Set layout direction based on language
Signed-off-by: ali ghorbani <ghorbani.ali.developer@gmail.com>
Diffstat (limited to 'lib/private/L10N')
-rw-r--r--lib/private/L10N/Factory.php16
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) {