Persian (Farsi) is a Right-to-Left language, but GUI is not changed

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Persian (Farsi) is a Right-to-Left language, but GUI is not changed

Frank Niessink

Hi,

Task Coach (http://www.taskcoach.org, developed using python and
wxPython) comes with different translations, some of which are RTL.
When the user selects Hebrew, the GUI is correctly switched to RTL as
well. However,  when selecting Farsi, the GUI is not switched.

The locale is set as follows:

    def _setLocale(self, *localeStrings):
        for localeString in localeStrings:
            languageInfo = wx.Locale.FindLanguageInfo(localeString)
            if languageInfo:
                self.__locale = wx.Locale(languageInfo.Language)
                break

This method takes multiple localeStrings, because Task Coach first
tries the long form (e.g. "fa_IR") and then the short form ("fa") in
case the first didn't succeed.

So, my first question is: why does this work for Hebrew ("he_IL"), but
not for Farsi ("fa_IR")?

The second question is: can I work around this by explicitly setting
the layout direction? I know how to get the current layout direction:

def currentLanguageIsRightToLeft():
    return wx.GetApp().GetLayoutDirection() == wx.Layout_RightToLeft

and I know I can set the layout direction of individual windows:

window.SetLayoutDirection(wx.Layout_RightToLeft))

But doing this for every window including dialogs is a bit intrusive
for a work around.

Thanks, Frank

--~--~---------~--~----~------------~-------~--~----~
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Persian (Farsi) is a Right-to-Left language, but GUI is not changed

Vadim Zeitlin-4
On Mon, 6 Jul 2009 21:30:00 +0200 Frank Niessink <[hidden email]> wrote:

FN> So, my first question is: why does this work for Hebrew ("he_IL"), but
FN> not for Farsi ("fa_IR")?

 Almost certainly simply because of this:

% egrep 'he_IL|fa_IR' misc/languages/langtabl.txt
wxLANGUAGE_FARSI                       fa_IR  LANG_FARSI       SUBLANG_DEFAULT                     LTR    "Farsi"
wxLANGUAGE_HEBREW                      he_IL  LANG_HEBREW      SUBLANG_DEFAULT                     RTL     "Hebrew"

I.e. Farsi is incorrectly marked as LTR instead of RTL. I've corrected it
now, thanks for reporting this problem.

FN> The second question is: can I work around this by explicitly setting
FN> the layout direction? I know how to get the current layout direction:
FN>
FN> def currentLanguageIsRightToLeft():
FN>     return wx.GetApp().GetLayoutDirection() == wx.Layout_RightToLeft
FN>
FN> and I know I can set the layout direction of individual windows:
FN>
FN> window.SetLayoutDirection(wx.Layout_RightToLeft))
FN>
FN> But doing this for every window including dialogs is a bit intrusive
FN> for a work around.

 All windows inherit their default layout direction from wxApp, so calling
overriding wxApp::GetLayoutDirection() should work for C++ programs. I
don't know if you can do this from Python though.

 Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/

attachment0 (194 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Persian (Farsi) is a Right-to-Left language, but GUI is not changed

Frank Niessink

2009/7/6 Vadim Zeitlin <[hidden email]>:
> On Mon, 6 Jul 2009 21:30:00 +0200 Frank Niessink <[hidden email]> wrote:
>
> FN> So, my first question is: why does this work for Hebrew ("he_IL"), but
> FN> not for Farsi ("fa_IR")?
>
> I.e. Farsi is incorrectly marked as LTR instead of RTL. I've corrected it
> now, thanks for reporting this problem.

Great to see this fixed, thanks.

> FN> The second question is: can I work around this by explicitly setting
> FN> the layout direction?

>  All windows inherit their default layout direction from wxApp, so calling
> overriding wxApp::GetLayoutDirection() should work for C++ programs. I
> don't know if you can do this from Python though.

A little experimenting suggests that simply overriding
GetLayoutDirection doesn't work in Python. I guess the windows don't
go through the Python-layer when invoking wxApp::GetLayoutDirection().

Thanks, Frank

--~--~---------~--~----~------------~-------~--~----~
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users
-~----------~----~----~----~------~----~------~--~---