[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #9157 [BridgeDB]: Persian and Arabic should be right aligned on bridges.tpo
#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:
---------------------------------+------------------------------------------
Comment(by sysrqb):
Replying to [comment:5 isis]:
> 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.
True, I wanted to limit it to the first lang in the Languages header. The
issue I had was that we have no guarantee that we support the first
language and we can't (easily) query gettext, as far as I can tell. So,
presently I hope everyone prefers languages read/written rtl over all
others.
>
> 2) There is a lot of duplicate code...the above bug is duplicated
twice.
Yeah, this certainly isn't the best implementation. I was/am more
concerned with not having a crappy website than code quality, specifically
for this.
> 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.
Initially I thought you were wrong, however now it appears I was wrong,
indeed. The answer was to add the `direction` css attribute. Now all is
good(er). I expected the translation to be typed rtl, so I thought the
only issue was that the text was not right-justified (which this does a
hacky job of accomplishing). hrmph. This should be correct now.
>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.
>
Probably true.
> 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.
Right, this was just me taking this ticket very literally. That was very
dumb, I admit.
>
> 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.
Yes, that is quite a zillion columns longs (for some number 'zillion'
consisting of ~176 characters)! :p
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9157#comment:7>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs