This is the mail archive of the guile-gtk@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

guile-gtk-0.17 i18n


Hi,

Last Saturday, I installed guile-1.3.4 and guile-gtk-0.17 into
my Linux box, and noticed that the latter would not recognize
"ja" (i.e., Japanese) locale.  I used gtk-1.2.6.

Indeed you can display Japanese characters if you invoke
(gdk-set-locale) and (gtk-rc-parse "gtkrc.ja") within your
Scheme script, but you can never input Japanese characters via
X11's input method.

After all you have to invoke gtk_set_locale BEFORE gtk_init.  I
modified the initialization routine as follows.

----------------------------------------------------------------------
*** guile-gtk-0.17/guile-gtk.c~	Wed Sep 29 05:39:13 1999
--- guile-gtk-0.17/guile-gtk.c	Sat Feb 19 21:13:01 2000
***************
*** 2374,2381 ****
       been initialized when Gdk has.  That is not completely correct,
       but the best I can do. */
  
!   if (gdk_display == NULL)
      gtk_init (argcp, argvp);
    sgtk_init_substrate ();
    sgtk_inited = 1;
  }
--- 2374,2383 ----
       been initialized when Gdk has.  That is not completely correct,
       but the best I can do. */
  
!   if (gdk_display == NULL) {
!     gtk_set_locale ();
      gtk_init (argcp, argvp);
+   }
    sgtk_init_substrate ();
    sgtk_inited = 1;
  }
----------------------------------------------------------------------

Now you can both display and input Japanese characters on the
GTK widgets if you are in "ja" locale; no hacking on Scheme
scripts is required.  For example, the present "galway" as it is
seems Japanese-capable now!  Of course, if you are in "C"
locale, the modified guile-gtk will behave exactly the same as
the original one.

I'd hope the next guile-gtk will pick up this modification.
Note that the pygtk of Python, a counterpart of the guile-gtk of
Guile, is implemented as follows, and thus locale-sensible (see
gnome-python-1.0.50/pygtk/gtk.py).

| # this sets up i18n input stuff
| _gtk.gtk_set_locale()
| 
| # initialise GTK (only if it can find the display -- this avoids segfaults)
| if '--display' in sys.argv or os.environ.has_key('DISPLAY'):
| 	_gtk.gtk_init()
| else:
| 	print 'No display information -- gtk_init not called'

Regards,

Hisao Suzuki		suzuki611@okisoft.co.jp, suzuki@acm.org

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]