Re: Patch for Automated RTL widgets



On 2 Oct 2000 otaylor fresnel labs redhat com wrote:

> 
> George <jirka 5z com> writes:
> 
> > On Sat, Sep 30, 2000 at 04:10:22PM -0200, Ali Abdin wrote:
> > > I am resending this because apparently my first mail didn't get through
> > > (possible due to the gnome.org DNS issues)
> > > 
> > > Anyway, attached is a patch for gtk_init that checks wether your locale
> > > (LC_ALL or LANG) is Arabic or Hebrew, if it is then it will automatically set
> > > the widget direction to RTL.
> > > 
> > > I think this is needed because LTR widgets with Arabic characters is not a
> > > very nice thing to look at. You can still run apps the traditional way by
> > > unsetting the locale for just that specific app.
> > > 
> > > This beats the alternative of having to manually set the text direction (by
> > > calling gtk_widget_set_default_direction in each and every app that wants to
> > > have an RTL direction.
> > 
> > Note one caveat:
> > 
> > It doesn't deal with aliases.   For example it would set RTL for
> > "LANG=hungarian", and it wouldn't set it for "LANG=hebrew.iso88598", both of
> > which are valid locales on my system.
> > 
> > It could be done if g_i18n_* stuff with unaliasing gets stuffed into glib.
> > Then you could just check the first two letters of the first string in the
> > language list.
> 
> Well, the other way of properly doing this, which I tend to think
> is more right, is:
> 
>  loc_to_match = setlocale (LC_CTYPE, NULL);

 I've played with g_i18n_* and I liked it much better than setlocale. As for
 'setlocale' - it doesn't expand aliases properly (at least on RH6.0). With 
 LANG=en g_i18n_* (correctly, according to various locale.alias files) returns
 en_US.ISO8859-1 as most preferable, while setlocale just returns "en" again.
 (though for LANG="ru" and for LANG="russian" it correctly returns
 "ru_RU.KOI8-R").

 Also, even if glibc can be fixed - there is no chance to fix libc on other
 unices, so IMO the only working solution is g_i18n_*. We live in imperfect
 world and using the wrapper is a right solution for almost everything.
 
> That is, let the C library tell you what locale it is using.
> It will have already dealiased the locale.
> 
> Regards,
>                                         Owen
> 

 PS: Is it OK with your "From:" header?
 
 Best regards,
  -Vlad





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]