public inbox for guile-gtk@sourceware.org
 help / color / mirror / Atom feed
* guile-gtk-0.17 i18n
@ 2000-02-20 19:36 Hisao Suzuki
  2000-02-21 15:03 ` Marius Vollmer
  0 siblings, 1 reply; 4+ messages in thread
From: Hisao Suzuki @ 2000-02-20 19:36 UTC (permalink / raw)
  To: jarios; +Cc: guile-gtk

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-02-22 11:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-20 19:36 guile-gtk-0.17 i18n Hisao Suzuki
2000-02-21 15:03 ` Marius Vollmer
2000-02-22  0:45   ` Hisao Suzuki
2000-02-22 11:45     ` Marius Vollmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).