On Wed, 2000-12-06 at 15:24:58, Zbigniew Chyla wrote:
(...)
Thanks tor this! It should be no problem for translators - I have another
patch, that doesn't _require_ modified translations. If you replace
_("File") with Q_("!menu!File") in your code, old translations (containing
only "File") will still work. I'll send improved patch tomorrow.
Attached patch implements new version of the Q_() macro. As I said before,
adding new prefixes to strings doesn't break existing translations.
This time I don't include whole po/Makefile.in.in but only small patch
adding "--keyword=Q_" to the list of xgettext options. Patch is being
applied by autogen.sh after running gettextize. Many GNOME apps
(eg. gnumeric) modify po/Makefile.in.in this way.
Zbigniew
diff -ruN /home/cyba/gcvs/gimp/ChangeLog gimp/ChangeLog
--- /home/cyba/gcvs/gimp/ChangeLog Sun Dec 3 20:16:03 2000
+++ gimp/ChangeLog Wed Dec 6 19:32:58 2000
@@ -1,3 +1,33 @@
+2000-12-06 Zbigniew Chyla [EMAIL PROTECTED]
+
+ I18n improvement - added support for Q_() macro (replacement for _()
+ allowing to add a prefix of the form "!some_prefix!" to the
+ string and thus making it possible to translate it differently in
+ different contexts).
+
+ * libgimp/gimpintl.h, libgimp/libgimp-intl.h: included "gimputils.h",
+ defined Q_() macro.
+
+ * libgimp/gimputils.h: added functions declarations:
+ gimp_i18n_qualifier_prefix_gettext(),
+ gimp_i18n_qualifier_prefix_dgettext(),
+ gimp_i18n_qualifier_prefix_noop().
+
+ * libgimp/gimputils.c: included "gimpintl.h", added functions:
+ gimp_i18n_qualifier_prefix_gettext(),
+ gimp_i18n_qualifier_prefix_dgettext(),
+ gimp_i18n_qualifier_prefix_noop().
+
+ * autogen.sh: patching po/Makefile.in.in (with
+ po/Makefile.in.in.i18npatch) after running gettextize.
+
+ * po/Makefile.in.in.i18n: new file - patch for po/Makefile.in.in (file
+ provided by gettextize), adds "--keyword=Q_" to the list of xgettext
+ options.
+
+ * po-libgimp/Makefile.in.in, po-plug-ins/Makefile.in.in: added
+ "--keyword=Q_" to the list of xgettext options.
+
2000-11-30 Andy Thomas [EMAIL PROTECTED]
* app/curves.c
diff -ruN /home/cyba/gcvs/gimp/libgimp/gimputils.h gimp/libgimp/gimputils.h
--- /home/cyba/gcvs/gimp/libgimp/gimputils.hThu Nov 23 12:38:50 2000
+++ gimp/libgimp/gimputils.hWed Dec 6 19:32:58 2000
@@ -45,13 +45,12 @@
const gchar *exceptions);
gchar * gimp_strcompress (const gchar *source);
#endif /* GLIB = 1.3 */
-
+gchar *gimp_i18n_qualifier_prefix_gettext (const gchar *string);
+gchar *gimp_i18n_qualifier_prefix_dgettext (const gchar *domain, const gchar *string);
+gchar *gimp_i18n_qualifier_prefix_noop (const gchar *string);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GIMPUTILS_H__ */
-
-
-
diff -ruN /home/cyba/gcvs/gimp/libgimp/libgimp-intl.h gimp/libgimp/libgimp-intl.h
--- /home/cyba/gcvs/gimp/libgimp/libgimp-intl.h Thu Nov 23 12:38:50 2000
+++ gimp/libgimp/libgimp-intl.h Wed Dec 6 19:32:58 2000
@@ -22,10 +22,12 @@
#ifndef __LIBGIMP_INTL_H__
#define __LIBGIMP_INTL_H__
+#include "gimputils.h"
#ifdef ENABLE_NLS
#include libintl.h
#define _(String) dgettext ("gimp-libgimp", String)
+#define Q_(String) gimp_i18n_qualifier_prefix_dgettext ("gimp-libgimp", String)
#undef gettext
#define gettext(String) dgettext ("gimp-libgimp", String)
#ifdef gettext_noop
@@ -37,6 +39,7 @@
/* Stubs that do something close enough. */
#define gettext(String) (String)
#define _(String) (String)
+#define Q_(String) gimp_i18n_qualifier_prefix_noop (String)
#define N_(String) (String)
#endif
diff -ruN /home/cyba/gcvs/gimp/libgimp/gimpintl.h gimp/libgimp/gimpintl.h
--- /home/cyba/gcvs/gimp/libgimp/gimpintl.h Thu Nov 23 12:38:48 2000
+++ gimp/libgimp/gimpintl.h Wed Dec 6 19:32:58 2000
@@ -25,6 +25,8 @@
#include glib.h
#include locale.h
+#include "gimputils.h"
+
/* Copied from gnome-i18n.h by Tom Tromey [EMAIL PROTECTED]
* Heavily modified by Daniel Egger [EMAIL PROTECTED]
* So be sure to hit me instead of him if something is wrong here
@@ -40,6 +42,7 @@
#ifdef ENABLE_NLS
#include libintl.h
#define _(String) gettext (String)
+#define Q_(String) gimp_i18n_qualifier_prefix_gettext (String)
#ifdef gettext_noop
#define N_(String) gettext_noop (String)
#else
@@ -53,6 +56,7 @@
#define dcgettext(Domain,Message,Type) (Message)
#define bindtextdomain(Domain,Directory) (Domain)
#define _(String) (String)
+#define Q_(String) gimp_i18n_qualifier_prefix_noop (String)
#define N_(String) (String)
#endif
diff -ruN /home/cyba/gcvs/gimp/libgimp/gimputils.c gimp/libgimp/gimputils.c
--- /home/cyba/gcvs/gimp/libgimp/gimputils.cThu Nov 23 12:38:50 2000
+++ gimp/libgimp/gimputils.cWed Dec 6 19:32:58 2000
@@ -23,8 +23,12 @@
#include