Re: Gtk Rtl patch



Robert Brady <robert suse co uk> writes:

> This patch does
> 
>   * check and use bind_textdomain_codeset, to make
>     localisations work on glibc2.2
> 
>   * export a translated string "default:LTR", which
>     if translated to "default:RTL" makes the default
>     widget direction right-to-left.
>  
>     (I think this is a nicer way of doing it than
>      the one previously suggested, that of checking
>      LANG, etc, for "he", "ar",...)

Good idea.
 
>     And then update fa.po and he.po to make use of that...
> 
>   * Make horizontal GtkRanges honour the widget direction...

I'm not 100% that flippig the ranges is the right thing to do, but
lets go ahead and do if people complain we can revert it or make it
configrable.

You can go ahead and commit, though see my comments below.

Regards,
                                        Owen

> --- gtk/gtkmain.c	2000/09/14 16:41:19	1.138
> +++ gtk/gtkmain.c	2000/10/22 01:04:25
> @@ -395,6 +395,9 @@
>  #ifdef ENABLE_NLS
>  #ifndef G_OS_WIN32
>    bindtextdomain(GETTEXT_PACKAGE, GTK_LOCALEDIR);
> +#ifdef HAVE_BIND_TEXTDOMAIN_CODSET
> +  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
> +#endif
>  #else

With this much nesting, you probably should go to

#ifdef ENABLE_NLS
#  ifndef G_OS_WIN32
   bindtextdomain(GETTEXT_PACKAGE, GTK_LOCALEDIR);
#    ifdef HAVE_BIND_TEXTDOMAIN_CODSET
   bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
#    endif 
#  else /* !G_OS_WIN32 */

To make the structure if the #ifdefsclear

> +  {
> +  /* Translate to default:RTL if you want your widgets
> +     to be RTL, otherwise translate to default:LTR */

GTK+ comment style is 

 /* Translate to default:RTL if you want your widgets
  * to be RTL, otherwise translate to default:LTR */  
  */

> +    char *e = _("default:LTR");
> +    if (strcmp(e, "default:RTL")==0) {
> +      gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
> +    } else if (strcmp(e, "default:LTR")) {
> +      g_warning("Whoever translated default:LTR did so wrongly.\n");
> +    }
> +  }
>  
>    /* Initialize the default visual and colormap to be
>     *  used in creating widgets. (We want to use the system
> Index: gtk/gtkrange.c
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gtk/gtkrange.c,v
> retrieving revision 1.37
> diff -u -r1.37 gtkrange.c
> --- gtk/gtkrange.c	2000/07/26 11:32:45	1.37
> +++ gtk/gtkrange.c	2000/10/22 01:04:28
> @@ -457,6 +457,9 @@
>        else if (x > right)
>  	x = right;
>  
> +      if (gtk_widget_get_direction(range) == GTK_TEXT_DIR_RTL)
> +	x = right - (x - left);
> +      

Are you sure this doesn't mess up scrollbars, which definitely
should not flip? You may have to do something in Gtk[HV]Scale
instead if that is a problem, or make a class flag indicating
whether the flipping should be done. 

Regards,
                                        Owen




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