[pmwiki-users] skins and RTL wikis

Hans design1 at softflow.uk
Sat Jun 10 17:38:10 CDT 2017


> This is in local/PmWikiAr.php:
>
>    $HTMLStylesFmt['rtl'] = 'body { direction:rtl; }';

thanks for your detailed reply!
I've been working on my Amber skin to make it RTL compatible.
Setting css rule  'body { direction:rtl; }' is a good start,
but quite a few other css rules needed to be set as well.
I guess that may be true for other skins as well.

> No, there are no automatic switches AFAIK.

Since PmWiki has no variable for facilitating automatic switching,
I could add a skin specific config variable, like
  $AmberConfig['rtl'] = 1;
or we could agree on a name for a general variable for this purpose,
for instance $EnableRTL or something like it. No core changes are
needed, and skins could use the same name, and such variable could be
used for group customisations on pmwiki.org, i.e. in local/PmWikiAr.php
etc.

In my skin.php file
I could also use the presence of $HTMLStylesFmt['rtl'] as a condition
to switch the skin to RTL, but that may not be too reliable, as any
key could have been used instead of 'rtl' in the css injection
  $HTMLStylesFmt['rtl'] = 'body { direction:rtl; }';
but perhaps I should do it anyway, I am not sure.

Another option may be to check for a lang= parameter in a
$HTMLTagAttr. For instance checking 'lang' for 'ar', 'fa', 'he' or 'ur'
which are the main language keys for a site using RTL script.
Something like:
//check HTML tag attribute for rtl language
//Arabic, Farsi, Hebrew, Urdu
if ($HTMLTagAttr) {
        SDVA($RTLLanguages, array('ar', 'fa', 'he', 'ur'));
        $ltag = ParseArgs($HTMLTagAttr);
        if (in_array($ltag['lang'], $RTLLanguages)) $AmberConfig['rtl'] = 1;
}

I am not sure if it is correct or legitimate to set RTL direction via HTML lang
attribute.

So I got three different possibilities to set a PHP variable for modifying the
skin for RTL. Setting a config variable seems the cleanest way.
But I like to release a skin update, which will then just work in
group PmWikiAr and PmWikiFa


Hans




More information about the pmwiki-users mailing list