I’m adding Arabic support to my program, my first right-to-left language. Mostly, it’s working amazingly well, but I’m seeing some things that puzzle me.
All of my images seem to get automatically reversed. Okay. On BitmapButtons, the images seem to get automatically reversed, but the button’s background behind the transparent part of the image doesn’t. I can use Image.Mirror() to undo the automatic reversal of the images where needed, but can’t figure out how to get the BitmapButton background to take the right shape. See the “BitmapButton.png” file attached, which is a simple green triangular button I use for a “Play” button.
My application is for the transcription and qualitative analysis of video and audio data, and allows users to create multiple simultaneous transcripts, each it its own window, all linked to the video file. This is actually analytically really important in some circumstances, and one use is to allow transcripts in multiple languages at the same time. The project funding this development needs mixed languages, to be transcribing in Arabic in one window (right-to-left) and English or French (left-to-right) in another AT THE SAME TIME. Is it possible to specify the wx.Locale by Frame instead of by application within wxPython, or at least to specify that some wx.RichTextCtrls will want right-to-left text while others will want left-to-right text within the same application at the same time?
As always, any comments, suggestions, and ideas are most welcome.
I'm adding Arabic support to my program, my first right-to-left
language. Mostly, it's working amazingly well, but I'm seeing some
things that puzzle me.
1. All of my images seem to get automatically reversed. Okay. On
BitmapButtons, the images seem to get automatically reversed, but the
button's background behind the transparent part of the image doesn't. I
can use Image.Mirror() to undo the automatic reversal of the images
where needed, but can't figure out how to get the BitmapButton
background to take the right shape. See the "BitmapButton.png" file
attached, which is a simple green triangular button I use for a "Play"
button.
Strange.
I don't know about this one, please ask about it on wx-users.
> 2. My application is for the transcription and qualitative analysis of
video and audio data, and allows users to create multiple simultaneous
transcripts, each it its own window, all linked to the video file. This
is actually analytically really important in some circumstances, and one
use is to allow transcripts in multiple languages at the same time. The
project funding this development needs mixed languages, to be
transcribing in Arabic in one window (right-to-left) and English or
French (left-to-right) in another AT THE SAME TIME. Is it possible to
specify the wx.Locale by Frame instead of by application within
wxPython, or at least to specify that some wx.RichTextCtrls will want
right-to-left text while others will want left-to-right text within the
same application at the same time?
I think wx.Locale can only be app-global and can't be set differently for certain windows, however there is a per-window or per-dc setting for RTL. See the [G|S]etLayoutDirection methods in wx.DC and wx.Window.
If all fails try saving the problem images reversed(180*) in your images dir or whatever and
loading them as the originals.
That will reverse them. Definitely…, or else there is a far more serious problem at hand.
Now before doing anything else, consider that the imaging work you have done might be beneficial to others,
and consider zipping the reversed images into a library and sharing for others which might experience
the same problem as you(might be language based images etc…).
I don’t speak or know Arabic, and my app doesn’t currently use it as a localised i18n lang,
but my and other apps do utilize i18n, which universally goes both ways as far as a contribution to the community and to unicode general(sometimes).
As far as defaults, etc…, cut, copy, paste,c…, I found it a pain to have to create extra images for greyscale disabled images, etc, just so they looked and
rendered correctly on older versions than wxPy whatever(is up to date), yet stable/working. older versions don’t do this and require a bit of extra dev help.
So for example it you have images that display chars of the lang, then consider doing the extra work to reverse them and share with others.
Sorry I can’t be of more help for that particular lang, but there IS someone out there that can decode stufflike that in times like this and/or help with the particular problem at hand.
The further I get into this, the more curious it gets. I’ve attached a wxPython sample program that displays a number of curious behaviors when using a Right-to-Left, specifically Arabic. Here’s what I see:
When the wx.Locale is set to Arabic, the wx.TextCtrl doesn’t seem to accept being forced into Left-to-Right functionality using the SetLayoutDirection() method. Alignment gets over-ridden, and the punctuation within the text gets manipulated as if we were dealing with Right-to-Left text in a Left-to-Right format. I need to be able to mix Arabic texts with English/French texts, each in their own window, when all is said and done. (I haven’t experimented with the wx.RichTextCtrl yet, which is ultimately what I need to use.)
wx.ComboBox controls do odd things with some text. Using SetLayoutDirection fixes the Box part of the control, but not the Combo part, and the GetStringSelection return is mangled.
wx.BitmapButtons show their image backwards, but the background of the image forwards. SetLayoutDirection() fixes this.
The QuickTime backend for the wxMediaCtrl on Windows doesn’t display the video, but it does play the audio when a video is played. The WMP10 backend works fine, at least with the couple of video files I tried it with, but that limits the formats that I can support when the user is using Arabic.
To play with my example code, unpack the zip archive, retaining the directory structure for the translation files. Change line 146 of the LtR_RtL.py file to point to a QuickTime-formatted video file on your system (*.mov, *.mp4, or *.m4v formats, for example.) Then run the sample program twice, passing in a “1” as the command line parameter the first time to see how things work in English (and how I want them to work), and a “2” the second time to see how things are different in Arabic.
I’d appreciate any help you can offer. Issue #2 is the most serious, from my point of view. Issue #3 is resolved, and I can live with telling Arabic users they have to convert to a WMP-compatible media format (although I’d rather not!) if I have to.
If all fails try saving the problem images reversed(180*) in your images dir or whatever and
loading them as the originals.
That will reverse them. Definitely…, or else there is a far more serious problem at hand.
Now before doing anything else, consider that the imaging work you have done might be beneficial to others,
and consider zipping the reversed images into a library and sharing for others which might experience
the same problem as you(might be language based images etc…).
I don’t speak or know Arabic, and my app doesn’t currently use it as a localised i18n lang,
but my and other apps do utilize i18n, which universally goes both ways as far as a contribution to the community and to unicode general(sometimes).
As far as defaults, etc…, cut, copy, paste,c…, I found it a pain to have to create extra images for greyscale disabled images, etc, just so they looked and
rendered correctly on older versions than wxPy whatever(is up to date), yet stable/working. older versions don’t do this and require a bit of extra dev help.
So for example it you have images that display chars of the lang, then consider doing the extra work to reverse them and share with others.
Sorry I can’t be of more help for that particular lang, but there IS someone out there that can decode stufflike that in times like this and/or help with the particular problem at hand.
–
You received this message because you are subscribed to the Google Groups “wxPython-users” group.