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]

Re: guile-gtk-0.17 i18n


Marius Vollmer <mvo@zagadka.ping.de> wrote:

> Why do you have to call gtk_set_locale before gtk_init?  Is there a
> good reason for this or can it be considered a bug in Gtk+?

gtk_init parses locale-specific gtkrc file(s) and opens a
locale-specific input method via XOpenIM(3x) of Xlib.  The
locale is supposed to have been already set.

gtk_set_locale invokes setlocale(3), and here is its man page:

| SETLOCALE(3)        Linux Programmer's Manual        SETLOCALE(3)
| 
| NAME
|        setlocale - set the current locale.
[snip]
|        On startup of the main program, the portable "C" locale is
|        selected as default.
[snip]

Thus you have to call gtk_set_locale before gtk_init.

> What are the consequences of calling gtk_set_locale?  Are there good
> reasons why anyone does _not_ want to call gtk_set_locale?  Why
> doesn't gtk_init call gtk_set_locale itself?

Besides setting the locale, gtk_set_locale sets gdk_use_mb, a
static gboolean variable which indicates whether multibyte
characters may be used or not, according to the locale.  In any
case, if you are in "C" locale, everything is the same as
default.

I don't know why gtk_init doesn't call gtk_set_locale.  Maybe it
is just a historical reason, or maybe some applications want to
run in "C" locale against any LANG environment variable value.

--
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]