Support for right-to-left languages

Bug #1661661 reported by Kathy Lussier on 2017-02-03
This bug affects 3 people
Affects Status Importance Assigned to Milestone

Bug Description

We have an Evergreen community member in Jordan who has implemented right-to-left support that depends on the locale that is selected. Adding this bug to see if we can work with their code to get this support in the core code.

See related discussion at

Ben Shum (bshum) wrote :

Navras Othman emailed me a copy of the files he's prepared so far to implement RTL support for his Evergreen test server. I am attaching a copy of his original modified files to this bug for history.

Ben Shum (bshum) wrote :

This is a copy of the DCO he included as well.

Ben Shum (bshum) wrote :

I have pulled all his changes into a collab branch and intend to do some review on it further.

He moved some inline CSS that was leftover in TPAC over into the stylesheet in addition to the addition of the custom RTL stylesheet files.

There is a hardcoded check for ar-AR that we might choose to replace in the future (especially if we finish bug 697926 to change the locale name to ar-JO). Mike suggested in IRC to make a new database column for the i18n languages to track whether they should be displayed LTR or RTL. This seems like the logical approach moving forward in case we add other languages in the future that are RTL.

Working collab branch here: collab/bshum/RTL-arabic;a=shortlog;h=refs/heads/collab/bshum/RTL-arabic

Changed in evergreen:
milestone: none → 2.12-beta
status: New → In Progress
assignee: nobody → Ben Shum (bshum)
tags: added: i18n
Ben Shum (bshum) wrote :

Force pushed a rebased branch on latest master to the same place as before. Included one minor tweak to the base.tt2 file... there was a missing closing bracket for the second stylesheet that was messing with the header blocks.

All the rest of the CSS changes appear to be working in my tests.

Will spend some more time looking at the way we handle the i18n choice for LTR vs. RTL. Adding a database column for that information seems easy, but getting the catalog to interpret the data from that field is the next and more interesting step.

NawJo (nawras) wrote :

That's great! Thank you Ben :)

Ben Shum (bshum) wrote :

Latest branch has three commits (original work by NawJo, fixup commit from bshum, and more tweaks by bshum for DB field).

Added a new column in config.i18n_locale for "rtl" which is either true or false (false by default). And then another upgrade script to add Arabic (Jordan) as a language with rtl set to true. Changed code in the template to check for this DB field and add the new CSS for RTL if rtl is set to true.

Working branch rebased: collab/bshum/RTL-arabic;a=shortlog;h=refs/heads/collab/bshum/RTL-arabic

tags: added: pullrequest
Changed in evergreen:
status: In Progress → Triaged
assignee: Ben Shum (bshum) → nobody
Ben Shum (bshum) wrote :

To test on a clean master installation (or from working branch), one might have to create some additional language setup if you do not do the full i18n dance during the install from git.

1. Setup the locale directory for opac:

mkdir -p /openils/var/data/locale/opac

2. Copy the locale file from master for Arabic (Jordan):

cp $Evergreen/build/i18n/po/tpac/ar-JO.po /openils/var/data/locale/opac/

3. And then go edit eg_vhost.conf and enable arabic as an option.

PerlAddVar OILSWebLocale "ar_jo"
PerlAddVar OILSWebLocale "/openils/var/data/locale/opac/ar-JO.po"

4. Restart apache

5. Test if the locale change to Arabic shows you cool Arabic text in a RTL fashion.

Ben Shum (bshum) wrote :

Added a fourth commit with short release note about the new RTL stylesheets and Arabic (Jordan) as a new language option.

Kathy Lussier (klussier) wrote :

This looks great! Thank you Nawras and Ben! Merged to master for inclusion in Evergreen 2.12.

Congrats Nawras on your first code contribution to the project! I hope it's the first of many!

Changed in evergreen:
status: Triaged → Fix Committed
NawJo (nawras) wrote :

Thank you Kathy, thanks Ben for your contribution and help :)

Sure, we'll work on RTL stylesheets for web client soon :)

Terran McCanna (tmccanna) wrote :

This is wonderful work, thank you!

Changed in evergreen:
status: Fix Committed → Fix Released
NawJo (nawras) wrote :

Hello everyone,

Thank you for all your comments :)

I combined RTL and LTR Stylesheets for TPAC in one stylesheet. You can check the result of my work here:

you can see the edited files and some notes in the attached compressed file. May you please check it and give me your suggestions for this change. Thank you!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers