On Thu, Jan 25, 2007 at 01:57:36PM -0500, Kevin DeKorte wrote: > > I'm trying to use gettext to do translation on a GOptionEntry table, > currently this works as is, but the text isn't translated. > > ... > > I tried this > > static GOptionEntry entries[] = { > {"window", NULL, 0, G_OPTION_ARG_INT, &embed_window, _("Window to > embed in"), "WID"}, > {"playlist", NULL, 0, G_OPTION_ARG_NONE, &playlist, _("File Argument > is a playlist"), NULL}, > {NULL} > }; > > But it won't compile. Using _() works on my other strings that are in > other areas.
_() is a shorthand for gettext(). Obviously, static variables cannot be initialized with results of run-time function calls. > So what is the best way to setup this entries variable and > allow it to use translation. Mark the strings with N_() http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#N-:CAPS and use g_option_context_set_translation_domain() http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html#g-option-context-set-translation-domain Yeti -- Whatever. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list