public inbox for guile-gtk@sourceware.org
 help / color / mirror / Atom feed
From: Hisao Suzuki <suzuki611@okisoft.co.jp>
To: <jarios@usa.net>
Cc: <guile-gtk@sourceware.cygnus.com>
Subject: guile-gtk-0.17 i18n
Date: Sun, 20 Feb 2000 19:36:00 -0000	[thread overview]
Message-ID: <E12MjgL-0000Fk-00@ares.sys1.ngo.okisoft.co.jp> (raw)

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

             reply	other threads:[~2000-02-20 19:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-20 19:36 Hisao Suzuki [this message]
2000-02-21 15:03 ` Marius Vollmer
2000-02-22  0:45   ` Hisao Suzuki
2000-02-22 11:45     ` Marius Vollmer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E12MjgL-0000Fk-00@ares.sys1.ngo.okisoft.co.jp \
    --to=suzuki611@okisoft.co.jp \
    --cc=guile-gtk@sourceware.cygnus.com \
    --cc=jarios@usa.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).