Skip to content

mvidner/bidi-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Testing bidirectional text

YaST, the installer of SUSE Linux Enterprise Server, is localized to many languages, one of them being Arabic. Dealing with text that is a mixture of Latin and Arabic script is complex and sometimes we have to deal with interesting bugs. Here are some of them, along with the way we have solved them. Hopefully it will be useful for you.

Background

Test bsc#989383, where parentheses are broken in a LTR layout but correct in a RTL layout.

Run this (never mind that the browser or the terminal may render the argument incorrectly already):

./yast-test.rb "ذ&اكرة USB كبيرة السعة التخزينية (عصا، قرص ذاكرة USB)..."

Here the global context is left to right. Even if you cannot read Arabic, you can observe that some of the widgets have both parentheses facing the same way, which is wrong:

LTR, bad

When we set the context to right-to-left, the labels are rendered correctly:

RTL, good

This is a case of an English word with a parenthesised English gloss in an Arabic text. Let's say "I love GNU (GNU's not Unix)":

./yast-label.rb "انا أحب GNU (Gnu's Not Unix)."

Without a RTL mark, bad

It helps to add an invisible right-to-left-mark (U+200F) between the GNU and the opening parenthesis:

./yast-label.rb $'انا أحب GNU \u200F(Gnu\'s Not Unix).'

With a RTL mark, good

hostname(5)

"... may be set if hostname(5) does not reflect the FQDN ..."

./yast-label.rb $'يمكن تعيينه إذا كان hostname(5) لا يعكس الاسم المميز المؤهل بالكامل'

Without a LTR mark, bad

Fixed by adding a Left-to-right mark, U+200E, after the (5):

./yast-label.rb $'يمكن تعيينه إذا كان hostname(5)\u200e لا يعكس الاسم المميز المؤهل بالكامل'

With a LTR mark, good

ldap://

The English string is "URIs (ldap://) of LDAP servers (comma separated)".

If we use no control characters, it comes out quite confused:

./yast-label.rb $'عناوين URI (ldap://) لخوادم LDAP (مفصولة باستخدام الفاصلة)'

LDAP, worse

Adding a RLM before "ldap" helps a bit:

./yast-label.rb $'عناوين URI (\u200fldap://) لخوادم LDAP (مفصولة باستخدام الفاصلة)'

LDAP, bad

But the full fix is trickier: surrounding the parens with LRMs and separating them from "URI" with a RLM.

./yast-label.rb $'عناوين URI \u200f\u200e(ldap://)\u200e لخوادم LDAP (مفصولة باستخدام الفاصلة)'

LDAP, good

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages