RomanHargrave / amphetype

Automatically exported from code.google.com/p/amphetype
0 stars 0 forks source link

RTL language support (Arabic and Hebrew) #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Thanks for this program. I love it! I've been testing it with different
languages I have to work with sometimes, and while it works great with
Russian and other LTR languages, it does not deal with right-to-left
languages correctly. For example, the program joins the Arabic letters
properly, but they stay aligned with the left-side of the program. This
applies to both the text that is to be typed and the text box you type in.

So I guess my request would be to add support for right-aligning the text
and display box when working with RTL languages. I don't need the program
itself translated or anything (although I'd be willing to help out with
that if you ever decide you want to do something like that. I could help
with Arabic and Russian).

Thanks!
btw I'm using this on linux (Ubuntu Intrepid)--once I had the dependencies
installed it worked great.

Original issue reported on code.google.com by stevebin...@gmail.com on 30 Dec 2008 at 6:23

GoogleCodeExporter commented 9 years ago
Oh, I've never thought about RTL languages and I have no idea how they work
programming-wise. Are you suggesting that it would work simply by making the
display-text and the input-box right-aligned when one is using an RTL language? 
Any
idea how to detect such a language? Or would a simple check-box in preferences 
be enough?

Original comment by tristesse on 30 Dec 2008 at 8:41

GoogleCodeExporter commented 9 years ago
Luckily we're not completely in the dark ages of RTL language support anymore. 
It's
not as simple as right-adjusting the text because the punctuation is 
interpreted as
LTR and gets put at the wrong end of the line (there are some other possible
problems, too, but I won't go into those here).

These days GTK and QT are capable of displaying RTL text. You would probably 
need to
tell it to both right-align and set the text as RTL. I'm not a programmer 
(nothing
above bash scripts sadly), but I've been digging around, and I've found what 
looks to
be the information you would need about adding RTL support in QT on this site:

http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/core/Qt.LayoutDirecti
on.html

The following 2 sites also had some information that looked useful in
trouble-shooting any problems with RTL input (they deal with QTextEdit, but I 
think
the principles they are talking about are the same).

http://www.qtforum.org/article/26493/qtextedit-has-problem-with-combination-of-t
ext-direction-and-alignment.html
http://elcuco2.blogspot.com/2008/10/qtextedit-and-qtextcursor-fun.html

I haven't been able to come up with any information about auto-detecting 
language,
although that last link I listed mentioned it in one of the comments, so there's
probably a way to do it. I know GTK apps these days (at least Gedit and GIMP) 
seem to
figure out that you're typing Arabic and switch you to the right direction
immediately. I'm guessing QT has something similar built-in once I can find it. 
I'll
keep working on that. As far as I'm concerned, a check-box would be good 
enough, but
I suppose that's not the most elegant way to do things if there's a way to
auto-detect the language.

Original comment by stevebin...@gmail.com on 31 Dec 2008 at 12:50