experimental rtl support; this will probably require a fair bit of work.

This commit is contained in:
redmatrix 2016-06-19 21:10:57 -07:00
parent 30841d9470
commit 905374c86e
3 changed files with 18 additions and 3 deletions

View File

@ -771,6 +771,7 @@ class App {
public static $groups; public static $groups;
public static $language; public static $language;
public static $langsave; public static $langsave;
public static $rtl = false;
public static $plugins_admin; public static $plugins_admin;
public static $module_loaded = false; public static $module_loaded = false;
public static $query_string; public static $query_string;
@ -2282,6 +2283,12 @@ function construct_page(&$a) {
$page = App::$page; $page = App::$page;
$profile = App::$profile; $profile = App::$profile;
// There's some experimental support for right-to-left text in the view/php/default.php page template.
// In v1.9 we started providing direction preference in the per language hstrings.php file
// This requires somebody with fluency in a RTL language to make happen
$page['direction'] = 0; // ((App::$rtl) ? 1 : 0);
header("Content-type: text/html; charset=utf-8"); header("Content-type: text/html; charset=utf-8");
// security headers - see https://securityheaders.io // security headers - see https://securityheaders.io

View File

@ -3,14 +3,21 @@
function po2php_run($argc,$argv) { function po2php_run($argc,$argv) {
if ($argc!=2) { if ($argc < 2) {
print "Usage: ".$argv[0]." <file.po>\n\n"; print "Usage: ".$argv[0]." <file.po>\n\n";
return; return;
} }
$rtl = false;
$pofile = $argv[1]; $pofile = $argv[1];
$outfile = dirname($pofile)."/hstrings.php"; $outfile = dirname($pofile)."/hstrings.php";
if($argc > 2) {
if($argv[2] === 'rtl')
$rtl = true;
}
if(strstr($outfile,'util')) if(strstr($outfile,'util'))
$lang = 'en'; $lang = 'en';
else else
@ -53,6 +60,7 @@ function po2php_run($argc,$argv) {
$out .= ' return '.$cond.';'."\n"; $out .= ' return '.$cond.';'."\n";
$out .= '}}'."\n"; $out .= '}}'."\n";
} }
$out .= 'App::$rtl = ' . intval($rtl) . ';';
if ($k!="" && substr($l,0,7)=="msgstr "){ if ($k!="" && substr($l,0,7)=="msgstr "){
if ($ink) { $ink = False; $out .= 'App::$strings["'.$k.'"] = '; } if ($ink) { $ink = False; $out .= 'App::$strings["'.$k.'"] = '; }

View File

@ -5,7 +5,7 @@
<script>var baseurl="<?php echo z_root() ?>";</script> <script>var baseurl="<?php echo z_root() ?>";</script>
<?php if(x($page,'htmlhead')) echo $page['htmlhead'] ?> <?php if(x($page,'htmlhead')) echo $page['htmlhead'] ?>
</head> </head>
<body> <body <?php if($page['direction']) echo 'dir="rtl"' ?> >
<?php if(x($page,'banner')) echo $page['banner']; ?> <?php if(x($page,'banner')) echo $page['banner']; ?>
<header><?php if(x($page,'header')) echo $page['header']; ?></header> <header><?php if(x($page,'header')) echo $page['header']; ?></header>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"><?php if(x($page,'nav')) echo $page['nav']; ?></nav> <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"><?php if(x($page,'nav')) echo $page['nav']; ?></nav>