On Wed, 13 Jul 2016 at 08:19:57, safaalfulaij via aur-dev wrote:
Add Right-To-Left layout support.
A commit message body that is (almost) a 1-to-1 copy of the subject does not help a lot. It would be great if you could give a very short summary of the implementation here, though.
Signed-off-by: Safa AlFulaij <safa1996alfulaij@gmail.com> --- web/html/css/archweb.css | 193 +++++++++++++++++++++++++++++++++++++++++++++ web/html/css/aurweb.css | 14 ++++ web/lib/aur.inc.php | 1 + web/lib/translator.inc.php | 10 +++ web/template/header.php | 4 +- 5 files changed, 221 insertions(+), 1 deletion(-)
diff --git a/web/html/css/archweb.css b/web/html/css/archweb.css index b7d6e1e..a908049 100644 --- a/web/html/css/archweb.css +++ b/web/html/css/archweb.css
archweb.css is imported from the archweb Git repository and synced from time to time. This means we must not make any changes to that file. All additions must be added to aurweb.css instead. For example...
@@ -58,6 +58,12 @@ ul { padding-left: 2em; }
+html[dir="rtl"] ol, +ul { + padding-left: auto; + padding-right: 2em; +} +
... this hunk should be moved there. I am not entirely sure but you might need to add !important or something similar. The same applies to all other changes below. It might even be a good idea to have all RTL related changes in one block in aurweb.css that is prefaced by a comment.
ul { list-style: square; } @@ -152,6 +158,11 @@ a.headerlink { padding-left: 0.5em; }
+html[dir="rtl"] a.headerlink { + padding-left: auto; + padding-right: 0.5em; +} + h3:hover > a.headerlink { visibility: visible; } [...] diff --git a/web/lib/translator.inc.php b/web/lib/translator.inc.php index d53bd53..0a422cf 100644 --- a/web/lib/translator.inc.php +++ b/web/lib/translator.inc.php @@ -52,6 +52,11 @@ $SUPPORTED_LANGS = array( "zh_TW" => "正體中文" );
+$RTL_LANGS = array( + "ar" => "Arabic", + "he" => "Hebrew" +);
I do not think we need to repeat the long names here, do we? Something like $RTL_LANGS = array("ar", "he"); should work. And then we can use in_array() instead of array_key_exists() in the following hunk:
[...] @@ -122,6 +128,10 @@ function set_lang() { $LANG = config_get('options', 'default_lang'); }
+ if array_key_exists($LANG, $RTL_LANGS) { + $LANG_DIRECTION = "rtl"; + } + if ($update_cookie) { $timeout = intval(config_get('options', 'persistent_cookie_timeout')); $cookie_time = time() + $timeout; [...]
Looks good to me otherwise. Thank you for working on this!