Skip to content
Snippets Groups Projects
Commit 27c095df authored by Jared Hancock's avatar Jared Hancock
Browse files

i18n: Honor RTL setting in client portal

parent db8dba3f
No related branches found
No related tags found
No related merge requests found
......@@ -315,6 +315,15 @@ class Internationalization {
return $best_match_langcode;
}
static function getCurrentLanguage($user=false) {
global $thisstaff, $thisclient, $cfg;
$user = $user ?: $thisstaff ?: $thisclient;
if ($user && method_exists($user, 'getLanguage'))
return $user->getLanguage();
return Internationalization::getDefaultLanguage();
}
static function bootstrap() {
require_once INCLUDE_DIR . 'class.translation.php';
......
......@@ -708,10 +708,7 @@ class TextDomain {
}
static function configureForUser($user=false) {
if ($user && method_exists($user, 'getLanguage'))
$lang = $user->getLanguage();
else
$lang = Internationalization::getDefaultLanguage();
$lang = Internationalization::getCurrentLanguage($user);
// Define locale for C-libraries
putenv('LC_ALL=' . $lang);
......
......@@ -8,7 +8,12 @@ $signout_url = ROOT_PATH . "logout.php?auth=".$ost->getLinkToken();
header("Content-Type: text/html; charset=UTF-8\r\n");
?>
<!DOCTYPE html>
<html>
<html <?php
if (($lang = Internationalization::getCurrentLanguage())
&& ($info = Internationalization::getLanguageInfo($lang))
&& (@$info['direction'] == 'rtl'))
echo 'dir="rtl" class="rtl"';
?>>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
......
<?php if (!isset($_SERVER['HTTP_X_PJAX'])) { ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html <?php
if ($thisstaff && ($lang = $thisstaff->getLanguage())
if (($lang = Internationalization::getCurrentLanguage())
&& ($info = Internationalization::getLanguageInfo($lang))
&& (@$info['direction'] == 'rtl'))
echo 'dir="rtl" class="rtl"';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment