From 0a858d2e4153328faa5b6cd8830914d55fedd449 Mon Sep 17 00:00:00 2001 From: filip Date: Sat, 3 Oct 2020 01:41:40 +0200 Subject: Managing RTL languages changes --- lib.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib.php b/lib.php index 510224d..8d3ae5b 100644 --- a/lib.php +++ b/lib.php @@ -75,6 +75,16 @@ $langs = array( 'zh-tw' => '正體中文' ); +/** + * Enables RTL language changes + * + * Returns TRUE if $locale is RTL + */ +function is_locale_rtl($locale) +{ + return in_array($locale, array('ar', 'he', 'tg', 'ur')); +} + class NCache { function __construct() { } @@ -328,15 +338,17 @@ function _mgnav_html($wrap = false, $lang = 'en', $inject = null, $vhost = 'www. $s[] = sprintf('%s', $inject); $s = implode($s); + $links_direction = is_locale_rtl($lang) ? ' dir="rtl"' : ''; + $links_position = is_locale_rtl($lang) ? 'ml-auto' : 'mr-auto'; $h = sprintf(' -
+
', $s); -- cgit v1.2.1