GNOME Bugzilla – Bug 106565
popt --help messages not translated
Last modified: 2004-12-22 21:47:04 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 _().
Is the attached patch a reasonable way to fix it ?
Created attachment 14455 [details] [review] patch
Shouldn't this be done at the libgnome/gnome-program level? Doesn't seem right to have that piece of code there. But since I have no clue about this sort of stuff, I'll shut up now ;)
At a really, really, really rough guess it could be .... libgnome/libgnome/gnome-program.c for (i = 0; (a_module = g_ptr_array_index(program_modules, i)); i++) { if (a_module->options) { includer.arg = a_module->options; includer.descrip = L_((char *)a_module->description); But I haven't tried that, and it probably doesn't work. Okay, this time I'll shut up for sure ;)
I'm pretty sure it won't work, that's why I didn't do it that way. The translations are in the panel's translation domain but this will translate them in the libgnome's translation domain ...
Christian: any thoughts ?
Don't know, I'll ask around.
Perhaps adding this to the poptOptions options[] struct would help { NULL, '\0', POPT_ARG_INTL_DOMAIN, GETTEXT_PACKAGE, 0, NULL, NULL } saw an example in libbonoboui
Any new insight on this?
Removing myself from Cc: since I'm already on the bugzilla-maint alias.
Mark: this patch fixes it for me. Is it ok to commit? Index: main.c =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/main.c,v retrieving revision 1.337 diff -u -r1.337 main.c --- main.c 17 Sep 2003 20:30:16 -0000 1.337 +++ main.c 13 Nov 2003 15:19:12 -0000 @@ -52,6 +52,7 @@ int main (int argc, char **argv) { + setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE);
No, it doesn't make any sense to me ... if this fixes the problem, then something must be broken somewhere else, right ?
Now is the time for my stupid question... How can a setlocale (LC_ALL, "") translate N_() strings? It's not possible. So I guess there's already something in libgnome handling the translation of the popt strings.
Hrm... What is the relation between this bug and bug #106549?
Chris?
Excerpt from #106549: "Calling setlocale(LC_ALL, "") or similar *before* the popt parses --help option is definitely required" setlocale is a standard call that actually sets the locale. It is required to make gettext work. On your N_() objection: This one has always been a #define N_(String) String macro that simply registers String for translation (needed for const variables). The actual translation is done using a gettext call on _(var), again, you have to call it after setlocale to output localized strings. Anyway, its safe to have a setlocale in the beginning of your app code, so you may want to commit the setlocale patch. regs, Chris
Christian: but isn't there a setlocale call in libgnome now?
Yes, that's right, but it is more of a fallback since many apps forget to call it which results in all those problems. It's up to you, it doesn't make a difference. regs, Chris
Christian: I don't get it. Why would it be a fallback? This really looks like a thing that should be done in libgnome so no program would have to call setlocale(). So why would we want to call setlocale in every program? (sorry if I'm slow at understanding :-))
Okay, my understanding here is that this has been fixed in libgnome. Re-open if that isn't the case.