[tor-bugs] #9157 [BridgeDB]: Persian and Arabic should be right aligned on bridges.tpo

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Aug 12 15:30:23 UTC 2013


#9157: Persian and Arabic should be right aligned on bridges.tpo
---------------------------------+------------------------------------------
 Reporter:  runa                 |          Owner:                
     Type:  task                 |         Status:  needs_revision
 Priority:  minor                |      Milestone:                
Component:  BridgeDB             |        Version:                
 Keywords:  RTL,translations,ui  |         Parent:                
   Points:                       |   Actualpoints:                
---------------------------------+------------------------------------------
Changes (by isis):

  * keywords:  important => RTL,translations,ui
 * cc: isis@… (added)
  * status:  needs_review => needs_revision
  * priority:  normal => minor


Comment:

 So, there are a couple things which need a bit of touchup:

  1) In HTTPServer.py, in classes WebRoot and WebResource, you do:
     {{{
         # Grab only the language (first two characters) so we know if we
 need
         # to right-justify the text
         langs = [ lang[:2] for lang in langs ]
         rtl = False
         if "ar" in langs or "fa" in langs:
             rtl = True
     }}}
 which, for example, if someone were to speak Deutsch and Arabic, they
 would see German text going right-to-left. See attached screenshot.

     2) There is a lot of duplicate code...the above bug is duplicated
 twice. The following structure is replicated several times:
     {{{
     % if rtl:
         <h4 style="float: right;">
     % else:
         <h4>
     % endif
         ${_("My bridges don't work! I need help!")}</h4>
     }}}
     which also brings me to...

     3) #2 is a bug also. This ticket was ill-specified, and it sucks a bit
 that you put work into it before someone could point out that right-
 alignment wasn´t what was needed. Farsi and Arabic (and others) need to be
 written right-to-left, which isn't the same as align-right, it's more like
 mirror image. I can read small amounts of Arabic, and the first thing I
 noticed was that the punctuation is on the wrong side of the sentence.
 Doing this can be a bit tricky to get right, esp. in our case where we
 have English text in the middle of RTL languages. The W3C has some good
 [http://www.w3.org/International/tutorials/bidi-xhtml/ documents] on best
 practices for getting it right, IIRC there's something about using the
 `dir` tag in the `<meta>` sections to set the default, and only when you
 need to change directions to not-the-default it gets used again. Also, I
 am not a web developer either, perhaps someone else knows more. In fact,
 I'm sure one of our friends on IRC coming from an RTL-language speaking
 country could probably write this code in five minutes, or, at least,
 better point out when things look weird to them.

     4) Farsi and Arabic aren't the only languages which we support which
 are RTL, off the top of my head, we've already got translations for
 Hebrew, and Kurdish is also one of the languages we support (if you want a
 wikipedia blackhole and an interesting history lesson about the mistreated
 Kurdish ethnic groups in Iran, Turkey and Syria...that just ate my past
 ten minutes). See the `bridgedb*` branches in
 [https://gitweb.torproject.org/translation.git the translation repo] for
 all the languages we get translations for.

     5) Line wrapping. This one also isn't your fault, because the line was
 already that way, but the OCD side of me prefers that PEP8 be followed
 when touching lines of code (which, yes, means fixing up past contributors
 mistakes). For example, I am looking at L16 in
 lib/bridgedb/i18n/bridges.html -- it's like a zillion columns long! In the
 case of translations, this is actually a tiny bit more than OCD, as
 someone has to review all the .po files from the translator volunteers
 before merging (mostly to make sure there aren't any <script> tags or
 other hijinks which could be used to exploit a browser). If the line is a
 zillion columns long, there's a higher chance that I might scroll past it
 and not actually see the end of it, especially if I'm bored from looking
 at 20+ files of gibberish.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9157#comment:5>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list