Mailing List Archive

Support open source code!


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

Re: locale



David Eduardo Gomez Noguera <davidgn@example.com> writes:

> I though the locales were my problem.  but it seems it isnt. I read
> questionmark's where i should read kanji. Any idea?  It happens both
> in a x-terminal and in gjiten (in the preferences and the kanji info
> window).
> 
> when i use cat or more to browse through ls or the sources of
> gjiten, everything seems ok.

This seems to be a problem of gjiten, triggered by Glibc 2.2. Glibc
2.2 seems to be pickier in some respects, so some things which were
incorrect but nevertheless worked with previous versions of Glibc
stopped working with Glibc 2.2.

Try the following tiny patch to gjiten-0.7:

--- gjiten-0.7/src/gjiten.c.orig	Tue Jan  2 19:24:05 2001
+++ gjiten-0.7/src/gjiten.c	Tue Jan  2 20:12:23 2001
@@ -1363,13 +1363,13 @@
 
 int main (int argc, char *argv[])
 {
- #ifdef ENABLE_NLS
-  bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
-  textdomain (PACKAGE);
-#endif
 
   set_strginfo();
   gtk_set_locale ();
+#ifdef ENABLE_NLS
+  bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
+  textdomain (PACKAGE);
+#endif
 
   if (getenv("LC_ALL") == NULL) putenv("LC_ALL=ja_JP");
   else if (getenv("LC_ALL")[0] != 'j') putenv("LC_ALL=ja_JP");

I just moved the calls to bindtextdomain() and textdomain() behind
the gtk_set_locale() call, because the info pages of gettext contain:

info-gettext>    The initialization of locale data should be done with more or less
info-gettext> the same code in every program, as demonstrated below:
info-gettext> 
info-gettext>      int
info-gettext>      main (argc, argv)
info-gettext>           int argc;
info-gettext>           char argv;
info-gettext>      {
info-gettext>        ...
info-gettext>        setlocale (LC_ALL, "");
info-gettext>        bindtextdomain (PACKAGE, LOCALEDIR);
info-gettext>        textdomain (PACKAGE);
info-gettext>        ...
info-gettext>      }

I think the gtk_set_locale() function contains a call to setlocale(),
therefore it is probably enough to move bindtextdomain() and
textdomain() behind get_set_locale(). At least it works for me like
that.

-- 
Mike Fabian   <mfabian@example.com>

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links