After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 106549 - popt --help messages not translated
popt --help messages not translated
Status: RESOLVED FIXED
Product: libgnome
Classification: Deprecated
Component: general
unspecified
Other All
: High normal
: ---
Assigned To: libgnome maintainer
libgnome maintainer
: 106561 106563 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2003-02-19 19:22 UTC by Noah Levitt
Modified: 2006-05-23 15:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch. (1.22 KB, patch)
2003-09-20 13:26 UTC, Christian Neumair
none Details | Review
Proposed patch for 2nd issue, seems to work. --help output from all libgnome-dependant apps is translated. (592 bytes, patch)
2003-09-20 16:28 UTC, Christian Neumair
none Details | Review
A combined patch for libgnome/libgnomeui/libbonobo (4.59 KB, patch)
2003-09-26 00:42 UTC, Hidetoshi Tajima
committed Details | Review

Description Noah Levitt 2003-02-19 19:22:48 UTC
The popt --help messages (poptOptions.descrip) are marked for translation
with N_, and most have translations in the .po files, but they are never
translated with _().
Comment 1 Kjartan Maraas 2003-05-03 21:17:06 UTC
This has been fixed by a patch from Hidetoshi Tajima from Sun. There's a closed dupe in here somewhere.
Comment 2 Kjartan Maraas 2003-05-03 21:20:55 UTC
And I'm on crack. That was a similar fix in gnomecc.
Comment 3 Kjartan Maraas 2003-05-12 12:48:29 UTC
Care to point out where they should be _() marked or whip up a patch?
Comment 4 Christian Neumair 2003-09-20 13:26:15 UTC
Created attachment 20136 [details] [review]
Proposed patch.
Comment 5 Christian Neumair 2003-09-20 13:29:10 UTC
The author's misassumption was that popt does some gettext magic, so
he just added gettext_noop calls - but this assumption was wrong.

regs,
 Chris
Comment 6 Christian Neumair 2003-09-20 13:30:44 UTC
*** Bug 106561 has been marked as a duplicate of this bug. ***
Comment 7 Christian Neumair 2003-09-20 13:36:56 UTC
*** Bug 106563 has been marked as a duplicate of this bug. ***
Comment 8 Noah Levitt 2003-09-20 15:14:52 UTC
I don't see why you've gone marking dups willy nilly... your patch
doesn't appear to translate any strings that originate outside
libgnome (if that's even possible).
Comment 9 Christian Neumair 2003-09-20 16:17:57 UTC
This problem is a bit tricky since the --help message is composed of
many strings:
- libgnome-specific (inter alia --load-modules) <1>
- popt-specific (Help options) <2>
- application-specific (Application options) <3>
- external stuff (GTK+, Session managment) <4>

<1> is covered by this patch, <2> is up to popt, <3> and <4> are weird:
If the application calls setlocale (LC_ALL, ""); and binds the text
domain before calling gnome_program_init, everything is translated,
including <3> and <4>. If not, nothing is translated. Therefore I
propose to add a setlocale (LC_ALL, ""); call to gnome_program_init -
if an application wants to prevent i18n, it would have to call
setlocale (LC_ALL, "C");.

regs,
 Chris
Comment 10 Christian Neumair 2003-09-20 16:28:07 UTC
Created attachment 20141 [details] [review]
Proposed patch for 2nd issue, seems to work. --help output from all libgnome-dependant apps is translated.
Comment 11 Noah Levitt 2003-09-20 16:35:30 UTC
> If the application calls setlocale (LC_ALL, ""); and binds the text
> domain before calling gnome_program_init, everything is translated,
> including <3> and <4>.

Not true. Take gedit for instance. The messages are marked
translatable, but are never translated, regardless of whether
setlocale() is called.

  static const struct poptOption options [] =
  {
          { "debug-utils", '\0', POPT_ARG_NONE, &debug_utils, 0,
            N_("Show utility debugging messages."), NULL },
  
          { "debug-metadata", '\0', POPT_ARG_NONE, &debug_utils, 0,
            N_("Show metadata debugging messages."), NULL },
  
          [...]
  };
  
  int
  main (int argc, char **argv)
  {
          [...]
          program = gnome_program_init ("gedit", VERSION,
                              [...]
                              GNOME_PARAM_POPT_TABLE, options,
                              [...]
                              NULL);
          [...]
  }
  
Comment 12 Christian Neumair 2003-09-20 16:54:48 UTC
Please, apply the patch and try again. For me it didn't work before
applying it, now it works.

regs,
 Chris
Comment 13 Hidetoshi Tajima 2003-09-26 00:23:54 UTC
[I think this should be given high priority, since all Gnome 
applications are affected by this.]

Calling setlocale(LC_ALL, "") or similar *before* the popt parses
--help option is definitely required, but, this only is not enough.
   
Indeed, when you build gedit on late CVS and run it in non-UTF-8
locales, the help options are printed to the stdout in two different
encodings and some are left untranslated while their Japanese
translations do exist and have been installed.

Below is how they actually happens in ja_JP.eucJP locale,
and the causes of the happenings.

  - gedit's "Application options", encoded in eucJP

       gedit main rouline calls gnome_program_init() and then
       bind_textdomain_codeset() for gedit's message catalog,
       so when popt parses --help messages, gettext returns locale's
       encoded strings. (See gedit/gedit/gedit2.c).

  - "GTK+", non-translated.
       This is normal.There is no po/mo for GTK+...

  - "Bonobo activation Support", non-translated.
       These translations are in libbonobo-2.0 message catalog, so

       bindtextdomain ("libbonobo-2.0", LIBGNOME_LOCALEDIR);

       has to be called somewhere.

  - "GNOME GConf support", "Gnome Library" options, encoded in UTF-8

      These two are from libgnome's message catalog, which
      has been already bound to "UTF-8". (gnome-init.c).

  - "Session Management", non-translated.

     This is from libgnomeui's gnome-client.c, but
     libgnomeui's message catalog is not bound to the domain
     yet.

  - "GNOME GUI Library", non-translated.

     This is from libgnomeui's gnome-ui-init.c, but
     libgnomeui's message catalog is not bound to the domain
     yet.

I'll attach a patch to fix these problems and make gedit's --help
messages all printed in the locale's encoding. 

Note that the change made to bind "libbonobo-2.0" to "UTF-8" is nasty
hack. This perhaps should be done in libbonobo's public function,
which can be called from libgnome's gnome_program_init().

Also, a lot of apps should be changed so that they don't bindtextcodeset
to UTF-8 when --help option is given. A hack in gnome_program_init()
to do this for all apps will be preferable than chaning all app's
codes.
Comment 14 Hidetoshi Tajima 2003-09-26 00:42:50 UTC
Created attachment 20301 [details] [review]
A combined patch for libgnome/libgnomeui/libbonobo
Comment 15 Hidetoshi Tajima 2003-09-26 00:48:10 UTC
Ah, while preparing the attached patch, I found putting
bindtextdomain into bobobo_activation_preinit() would work,
so what I said was nasty in the previous comment does not
exist in the patch.

please review and let me know if they are okay to commit to 
the HEAD.
Comment 16 alexander.winston 2004-01-21 07:06:05 UTC
Someone needs to review this and/or commit.
Comment 17 Anders Carlsson 2004-01-21 07:59:19 UTC
I've committed this. However, it doesn't look like the words "Help
options" and "Application options" are being translated, so I'm not
closing this bug yet.
Comment 18 Christian Neumair 2004-01-21 17:02:36 UTC
Anders: Please apply my first patch from 09/20/03. It should work.

regs,
 Chris
Comment 19 Anders Carlsson 2004-01-21 20:36:56 UTC
I tried it at first, but it didn't work. For some weird reason it does
now though. Thanks!
Comment 20 Christophe Fergeau 2004-03-15 22:54:06 UTC
--- libgnome/libgnome/gnome-init.c	23 Sep 2003 20:18:44 -0000	1.106
+++ libgnome/libgnome/gnome-init.c	26 Sep 2003 00:39:40 -0000
+#if 0
 #ifdef HAVE_BIND_TEXTDOMAIN_CODESET
 		bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 #endif
-
+#endif

This part of the patch breaks gnome-panel when it tries to get
translations from libgnome. My default charset is ISO8859-1, and when
gnome-panel gets translated strings from libgnome, it seems to get
them encoded in ISO8859-1, which doesn't work at all when trying to
put it in a GTK+ label.
To reproduce it, launch gnome-panel witha  non utf8 locale, open the
panel run dialog, type a non existing name in it. I get an error
message about gnome-panel not being able to create the dialog instead
of a translated message saying the specified location doesn't exist.
Comment 21 Anders Carlsson 2004-03-16 11:50:29 UTC
I've put back the bindtextdomain_codeset call. However, I'm going to
keep this bug open until we have a system where we can print out the
--help strings in the locale encoding.
Comment 22 Anders Carlsson 2004-05-02 09:33:46 UTC
Comment on attachment 20301 [details] [review]
A combined patch for libgnome/libgnomeui/libbonobo

This was committed as far as I know.
Comment 23 Kjartan Maraas 2005-08-12 10:43:40 UTC
I still see english output from 1) and 2) here even with all bits commited. 2)
could very well be because popt isn't translated to nb_NO, but 1) should have
been working, right?
Comment 24 Kjartan Maraas 2006-04-04 09:35:20 UTC
1) is still broken here. Anyone know what's up? The first patch attached here also seems to have been applied. Why is it marked obsolete then?
Comment 25 Christian Persch 2006-04-06 12:17:21 UTC
(In reply to comment #21)
> I've put back the bindtextdomain_codeset call. However, I'm going to
> keep this bug open until we have a system where we can print out the
> --help strings in the locale encoding.

We have that system now since this works when using goption argument parsing (well, once the patch from bug 335159 is checked in).
Comment 26 Kjartan Maraas 2006-05-23 15:49:56 UTC
The patch went in so I'm closing this bug.