Fix mixed text direction
Thread poster: Hassan Achahbar

Hassan Achahbar  Identity Verified
Local time: 07:02
Member (2010)
English to Arabic
+ ...
Nov 21

Proz is probably old enough to have a driver's license in any country but its support for right-to-left languages is a mess. Whenever a paragraph starts with LTR and includes RTL content the result is an incorrect order of segments making the paragraph impossible to read. A single Latin character will confuse an Arabic paragraph beyond readability. Paragraphs containing LTR only content are incorrectly aligned too, but this issue is of lesser importance since readability is not affected.

2020-11-21_160143

The text above is unreadable, and it gets worse when you throw in more Latin characters. To get around this issue I jump to a new line every time I want to include Latin words/characters. I noticed many translators do this too.

The attribute dir="auto" is an HTML5 attribute that fixes mixed user content formatting. It's an HTML attribute, CSS "direction" property only recognizes rtl and ltr, "auto" value is invalid, at least for now.

This is how W3 describes the attribute:
https://www.w3.org/International/articles/inline-bidi-markup/

HTML5 addresses another need: text dropped into a page, say from a database, when you don't know its base direction. Before HTML5, you could only set the dir attribute to ltr or rtl, and had to somehow determine yourself which of them was appropriate.

HTML5 provides a new value for the dir attribute: auto. The auto value tells the browser to look at the first strongly typed character in the element. If it's a right-to-left typed character such as a Hebrew or Arabic letter, the element will get a direction of rtl. If it's, say, a Latin character, the direction will be ltr.

There are corner cases where this may not give the desired outcome, but it should usually produce the desired result.

Note that the browser ignores any neutral or weak characters at the beginning of the text when looking for the first strong character. It also ignores anything inside a bdi element or an element with a dir tag of its own, including auto.

Like any other use of the dir attribute in HTML5, dir="auto" also directionally isolates its content from its surroundings.


This attribute should be applied only to the text's immediate container in the view template so as not to interfere with the site's global layout, and to both the old table-based and the new div-based layouts. Since the attribute only affects how text is displayed it will fix the presentation of all previous mixed direction entries over the 20 years or so of Proz existence. The place where I want to see this issue fixed as soon as possible is the KudoZ section, specifically the term and explanation entries. But the fix should be applied to all user content templates. I had made a similar suggestion 6 years ago when I found out the contest entries are badly formatted, but my suggestion was only applied to contest entries.

2020-11-21_174450

As you can see in the screenshot above, after adding this tag, the paragraph is correctly formatted and is aligned to the right. But text direction is separate from text alignment. You can have an Arabic text correctly formatted with dir="auto" and still be able to align the text any way with CSS property text-align.

If you need any help fixing this issue I'll be glad to assist.

[Edited at 2020-11-21 16:46 GMT]


Arabic & More
 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

Fix mixed text direction

Advanced search






TM-Town
Manage your TMs and Terms ... and boost your translation business

Are you ready for something fresh in the industry? TM-Town is a unique new site for you -- the freelance translator -- to store, manage and share translation memories (TMs) and glossaries...and potentially meet new clients on the basis of your prior work.

More info »
Anycount & Translation Office 3000
Translation Office 3000

Translation Office 3000 is an advanced accounting tool for freelance translators and small agencies. TO3000 easily and seamlessly integrates with the business life of professional freelance translators.

More info »



Forums
  • All of ProZ.com
  • Term search
  • Jobs
  • Forums
  • Multiple search