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 448201 - Translate g_option_context_new text
Translate g_option_context_new text
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Shell
2.10.x (obsolete)
Other Linux
: Normal trivial
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
Depends on:
Blocks: 236276
 
 
Reported: 2007-06-16 13:30 UTC by Gabor Kelemen
Modified: 2007-06-18 05:36 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18


Attachments
Trivial fix, using g_option_context_set_translation_domain (481 bytes, patch)
2007-06-16 13:31 UTC, Gabor Kelemen
committed Details | Review

Description Gabor Kelemen 2007-06-16 13:30:13 UTC
The program description, which appears after starting with --help, is marked for translation, but the translated text doesn't shows up.
Comment 1 Gabor Kelemen 2007-06-16 13:31:24 UTC
Created attachment 90070 [details] [review]
Trivial fix, using g_option_context_set_translation_domain
Comment 2 Srinivasa Ragavan 2007-06-16 17:27:21 UTC
 	g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);

Doesn;t the third param set this already? Atleast the devhelp says so. If it doesn't work, may be a glib bug?
Comment 3 Gabor Kelemen 2007-06-17 11:18:36 UTC
I don't know, if it sets or should set - if I run evolution --help, the text doesn't appear translated, with the patch, it appears translated. 

I got the idea from this comment: http://bugzilla.gnome.org/show_bug.cgi?id=445865#c3
While updating the patch of that bug, I played a bit with N_(), _() and g_option_context_set_translation_domain, and only the last one showed translated the string. Then I started to check other apps, and several other (file-roller, evince, evolution, etc.) seem to have this problem too. 

However, gedit doesn't, and this is really strange, as it uses _() to translate the context and the sring appears translated. 
The trick is, that gedit uses setlocale (LC_ALL, ""); before the bindtextdomain() call: 
http://svn.gnome.org/viewcvs/gedit/trunk/gedit/gedit.c?revision=5369&view=markup
so that it can translate the context with the _() macro. 

So my opinion is, that either setlocale, or g_option_context_set_translation_domain should be used in order to correctly translate the context information. I don't know which one is the best practice.

Comment 4 Srinivasa Ragavan 2007-06-17 17:40:53 UTC
g_option_context_add_main_entries ()

void        g_option_context_add_main_entries
                                            (GOptionContext *context,
                                             const GOptionEntry *entries,
                                             const gchar *translation_domain);

A convenience function which creates a main group if it doesn't exist, adds the entries to it and sets the translation domain.

This is the API spec. I think if it doesn't work, may be worth filling this in glib. Im fine to push it meanwhile.

Comment 5 Gabor Kelemen 2007-06-17 19:22:16 UTC
After reading the docs, seems that g_option_context_add_main_entries () is for  translating _only_ the description and arg_description fields of GOptionEntry's, (and adding an array of those to a context).
 
To translate the context (g_option_context_new ()), summary (g_option_context_set_summary ()) and description (g_option_context_set_description ()) of a GOptionContext, you need to use g_option_context_set_translate_func (), for which g_option_context_set_translation_domain () is a convenience function. 

Strange indeed, but this seems to be the intended usage, if I don't get it wrong.
Comment 6 Srinivasa Ragavan 2007-06-18 05:36:34 UTC
Committed to head.