GNOME Bugzilla – Bug 122111
Add gi18n.h, gi18n-lib.h
Last modified: 2011-02-18 16:07:08 UTC
To avoid people having to reinvent the _()/N_() wheel, it probably makes sense to add some functionality for this to GLib. We can't add _() to glib.h for multiple reasons A) It would conflict with people who are already defining it themselves. B) Different definitions are needed for libraries and applications. So, my proposal is to add two header files #include <glib/gi18n.h> or: #define GETTEXT_PACKAGE "gtk2" #include <glib/gi18n-lib.h> That you include depending on whether you are writing a library or an application. (Should we have the glib/ ? We dont' for other glib headers that you typically include.)
Do these look suitable ? I've made them includable via <glib/gi18n.h> rather than <gi18n.h>, following gprintf.h. Note that the patch also contains the stuff for bug 97556.
Created attachment 19931 [details] gi18n.h
Created attachment 19932 [details] gi18n-lib.h
Created attachment 19933 [details] [review] glue
Looks good to me.
Amen. Please lets get this into 2.3.1
We should grep around for all the copies I did a quick search on ifdef gettext_noop gnome-vfs-extras/gnome-vfs-extras-i18n.h:14:# ifdef gettext_noop atk/atk/atkintl.h:9:#ifdef gettext_noop eel/eel/eel-i18n.h:37:#ifdef gettext_noop foocanvas/libfoocanvas/foo-canvas-i18n.h:48:# ifdef gettext_noop glade/glade/gladeconfig.h:42:#ifdef gettext_noop glib/glib/glibintl.h:15:#ifdef gettext_noop gnome-db/frontend/gnome-db.h:33:# ifdef gettext_noop gnome-desktop/libgnome-desktop/gnome-desktop-i18n.h:38:#ifdef gettext_noop gnome-office/libgnomeoffice/go-intl.h:29:#ifdef gettext_noop gnome-vfs/libgnomevfs/gnome-vfs-i18n.h:9:# ifdef gettext_noop gtk+/gdk/gdkintl.h:9:#ifdef gettext_noop gtk+/gdk-pixbuf/gdk-pixbuf-i18n.h:9:#ifdef gettext_noop gtk+/gtk/gtkintl.h:9:#ifdef gettext_noop gtksourceview/gtksourceview/gtksourceview-i18n.h:43:# ifdef gettext_noop libbonobo/bonobo/bonobo-i18n.h:49:# ifdef gettext_noop libbonobo/bonobo-activation/bonobo-activation-i18n.h:27:# ifdef gettext_noop libcomprex/libcomprex/internal.h:84:# ifdef gettext_noop libgda/libgda/gda-intl.h:30:#ifdef gettext_noop libgnomecanvas/libgnomecanvas/gnome-canvas-i18n.h:48:# ifdef gettext_noop libgnomedb/libgnomedb/gnome-db-i18n.h:49:# ifdef gettext_noop libgnomeprint/libgnomeprint/gnome-print-i18n.h:27:# ifdef gettext_noop libgnomeprintui/libgnomeprintui/gnome-print-i18n.h:28:# ifdef gettext_noop sodipodi/src/helper/sp-intl.h:22:#ifdef gettext_noop glade/examples/editor/src/support.h:18:# ifdef gettext_noop gnumeric/src/cut-n-paste-code/foocanvas/libfoocanvas/foo-canvas-i18n.h:50:# ifdef gettext_noop libguppi/libguppi/canvas/foocanvas/libfoocanvas/foo-canvas-i18n.h:50:# ifdef gettext_noop
Since this bug is resolved, I guess you will have to file bugs against individual components to make this list useful.
Oops, sorry for my posting to the old bug#97556. But my question is: What is the msgid format that these new functions implement? I can't see any immediate information about this in the header files. Matthias, could you add some? That would be very nice.
We're following the gettext manual here. Everything up to the first '|' is context. You can find some docs by build the 2.3 api docs, or look at the source: docs/reference/glib/tmpl/i18n.sgml