diff -ruN /home/cyba/gcvs/gimp/libgimp/gimputils.h gimp/libgimp/gimputils.h --- /home/cyba/gcvs/gimp/libgimp/gimputils.h Thu Nov 23 12:38:50 2000 +++ gimp/libgimp/gimputils.h Wed 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 # 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 #include +#include "gimputils.h" + /* Copied from gnome-i18n.h by Tom Tromey * Heavily modified by Daniel Egger * So be sure to hit me instead of him if something is wrong here @@ -40,6 +42,7 @@ #ifdef ENABLE_NLS # include # 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.c Thu Nov 23 12:38:50 2000 +++ gimp/libgimp/gimputils.c Wed Dec 6 19:32:58 2000 @@ -23,8 +23,12 @@ #include #include +#include "gimpintl.h" #include "gimputils.h" +#define Q_PREFIX_START '!' +#define Q_PREFIX_END '!' + /** * gimp_strescape: * @source: A string to escape special characters in. @@ -197,3 +201,113 @@ return dest; } #endif /* GLIB <= 1.3 */ + +/*** + * gimp_i18n_qualifier_prefix_gettext + * + **/ +gchar * +gimp_i18n_qualifier_prefix_gettext (const gchar *string) +{ + g_assert (string != NULL); + + if (*string != Q_PREFIX_START) { + return gettext (string); + } else { + gchar *translation; + + translation = gettext (string); + if (translation != string) { + if (*translation != Q_PREFIX_START) { + return translation; + } else { + gchar *real_translation; + + real_translation = strchr (translation + 1, Q_PREFIX_END); + if (real_translation != NULL) { + return real_translation + 1; + } else { + g_warning ("Ivalid Q_() translation: \"%s\"", translation); + return translation; + } + } + } else { + gchar *real_string; + + real_string = strchr (string + 1, Q_PREFIX_END); + if (real_string != NULL) { + return gettext (real_string + 1); + } else { + g_warning ("Ivalid Q_() string: \"%s\"", string); + return (gchar *) string; + } + } + } +} + +/*** + * gimp_i18n_qualifier_prefix_dgettext + * + **/ +gchar * +gimp_i18n_qualifier_prefix_dgettext (const gchar *domain, const gchar *string) +{ + g_assert (string != NULL); + + if (*string != Q_PREFIX_START) { + return dgettext (domain, string); + } else { + gchar *translation; + + translation = dgettext (domain, string); + if (translation != string) { + if (*translation != Q_PREFIX_START) { + return translation; + } else { + gchar *real_translation; + + real_translation = strchr (translation + 1, Q_PREFIX_END); + if (real_translation != NULL) { + return real_translation + 1; + } else { + g_warning ("Ivalid Q_() translation: \"%s\"", translation); + return translation; + } + } + } else { + gchar *real_string; + + real_string = strchr (string + 1, Q_PREFIX_END); + if (real_string != NULL) { + return dgettext (domain, real_string + 1); + } else { + g_warning ("Ivalid Q_() string: \"%s\"", string); + return (gchar *) string; + } + } + } +} + +/*** + * gimp_i18n_qualifier_prefix_noop + * + **/ +gchar * +gimp_i18n_qualifier_prefix_noop (const gchar *string) +{ + g_assert (string != NULL); + + if (*string != Q_PREFIX_START) { + return (gchar *) string; + } else { + gchar *real_string; + + real_string = strchr (string + 1, Q_PREFIX_END); + if (real_string != NULL) { + return real_string + 1; + } else { + g_warning ("Ivalid Q_() string: \"%s\"", string); + return (gchar *) string; + } + } +} diff -ruN /home/cyba/gcvs/gimp/po/Makefile.in.in.i18npatch gimp/po/Makefile.in.in.i18npatch --- /home/cyba/gcvs/gimp/po/Makefile.in.in.i18npatch Thu Jan 1 01:00:00 1970 +++ gimp/po/Makefile.in.in.i18npatch Wed Dec 6 19:35:34 2000 @@ -0,0 +1,9 @@ +--- Makefile.in.in.clean Wed Dec 6 19:33:55 2000 ++++ Makefile.in.in Wed Dec 6 19:32:58 2000 +@@ -87,5 +87,5 @@ + $(srcdir)/$(PACKAGE).pot: $(POTFILES) + $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ +- --add-comments --keyword=_ --keyword=N_ \ ++ --add-comments --keyword=_ --keyword=N_ --keyword=Q_ \ + --files-from=$(srcdir)/POTFILES.in \ + && test ! -f $(PACKAGE).po \ diff -ruN /home/cyba/gcvs/gimp/po-libgimp/Makefile.in.in gimp/po-libgimp/Makefile.in.in --- /home/cyba/gcvs/gimp/po-libgimp/Makefile.in.in Thu Nov 23 12:39:17 2000 +++ gimp/po-libgimp/Makefile.in.in Wed Dec 6 19:32:58 2000 @@ -84,7 +84,7 @@ $(srcdir)/$(PACKAGE).pot: $(POTFILES) $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ - --add-comments --keyword=_ --keyword=N_ \ + --add-comments --keyword=_ --keyword=N_ --keyword=Q_ \ --files-from=$(srcdir)/POTFILES.in \ && test ! -f $(PACKAGE).po \ || ( rm -f $(srcdir)/$(PACKAGE).pot \ diff -ruN /home/cyba/gcvs/gimp/po-plug-ins/Makefile.in.in gimp/po-plug-ins/Makefile.in.in --- /home/cyba/gcvs/gimp/po-plug-ins/Makefile.in.in Thu Nov 23 12:39:17 2000 +++ gimp/po-plug-ins/Makefile.in.in Wed Dec 6 19:32:58 2000 @@ -84,7 +84,7 @@ $(srcdir)/$(PACKAGE).pot: $(POTFILES) $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ - --add-comments --keyword=_ --keyword=N_ \ + --add-comments --keyword=_ --keyword=N_ --keyword=Q_ \ --files-from=$(srcdir)/POTFILES.in \ && test ! -f $(PACKAGE).po \ || ( rm -f $(srcdir)/$(PACKAGE).pot \