]> git.pld-linux.org Git - packages/gimp.git/blame - gimp-i18n.patch
"Q_() makro for translation with prefixes <<like in freeciv>>" by cyba@gnome.pl
[packages/gimp.git] / gimp-i18n.patch
CommitLineData
bad64047
AF
1diff -ruN /home/cyba/gcvs/gimp/libgimp/gimputils.h gimp/libgimp/gimputils.h
2--- /home/cyba/gcvs/gimp/libgimp/gimputils.h Thu Nov 23 12:38:50 2000
3+++ gimp/libgimp/gimputils.h Wed Dec 6 19:32:58 2000
4@@ -45,13 +45,12 @@
5 const gchar *exceptions);
6 gchar * gimp_strcompress (const gchar *source);
7 #endif /* GLIB <= 1.3 */
8-
9+gchar *gimp_i18n_qualifier_prefix_gettext (const gchar *string);
10+gchar *gimp_i18n_qualifier_prefix_dgettext (const gchar *domain, const gchar *string);
11+gchar *gimp_i18n_qualifier_prefix_noop (const gchar *string);
12
13 #ifdef __cplusplus
14 }
15 #endif /* __cplusplus */
16
17 #endif /* __GIMPUTILS_H__ */
18-
19-
20-
21diff -ruN /home/cyba/gcvs/gimp/libgimp/libgimp-intl.h gimp/libgimp/libgimp-intl.h
22--- /home/cyba/gcvs/gimp/libgimp/libgimp-intl.h Thu Nov 23 12:38:50 2000
23+++ gimp/libgimp/libgimp-intl.h Wed Dec 6 19:32:58 2000
24@@ -22,10 +22,12 @@
25 #ifndef __LIBGIMP_INTL_H__
26 #define __LIBGIMP_INTL_H__
27
28+#include "gimputils.h"
29
30 #ifdef ENABLE_NLS
31 # include <libintl.h>
32 # define _(String) dgettext ("gimp-libgimp", String)
33+# define Q_(String) gimp_i18n_qualifier_prefix_dgettext ("gimp-libgimp", String)
34 # undef gettext
35 # define gettext(String) dgettext ("gimp-libgimp", String)
36 # ifdef gettext_noop
37@@ -37,6 +39,7 @@
38 /* Stubs that do something close enough. */
39 # define gettext(String) (String)
40 # define _(String) (String)
41+# define Q_(String) gimp_i18n_qualifier_prefix_noop (String)
42 # define N_(String) (String)
43 #endif
44
45diff -ruN /home/cyba/gcvs/gimp/libgimp/gimpintl.h gimp/libgimp/gimpintl.h
46--- /home/cyba/gcvs/gimp/libgimp/gimpintl.h Thu Nov 23 12:38:48 2000
47+++ gimp/libgimp/gimpintl.h Wed Dec 6 19:32:58 2000
48@@ -25,6 +25,8 @@
49 #include <glib.h>
50 #include <locale.h>
51
52+#include "gimputils.h"
53+
54 /* Copied from gnome-i18n.h by Tom Tromey <tromey@creche.cygnus.com>
55 * Heavily modified by Daniel Egger <Daniel.Egger@t-online.de>
56 * So be sure to hit me instead of him if something is wrong here
57@@ -40,6 +42,7 @@
58 #ifdef ENABLE_NLS
59 # include <libintl.h>
60 # define _(String) gettext (String)
61+# define Q_(String) gimp_i18n_qualifier_prefix_gettext (String)
62 # ifdef gettext_noop
63 # define N_(String) gettext_noop (String)
64 # else
65@@ -53,6 +56,7 @@
66 # define dcgettext(Domain,Message,Type) (Message)
67 # define bindtextdomain(Domain,Directory) (Domain)
68 # define _(String) (String)
69+# define Q_(String) gimp_i18n_qualifier_prefix_noop (String)
70 # define N_(String) (String)
71 #endif
72
73diff -ruN /home/cyba/gcvs/gimp/libgimp/gimputils.c gimp/libgimp/gimputils.c
74--- /home/cyba/gcvs/gimp/libgimp/gimputils.c Thu Nov 23 12:38:50 2000
75+++ gimp/libgimp/gimputils.c Wed Dec 6 19:32:58 2000
76@@ -23,8 +23,12 @@
77 #include <string.h>
78 #include <glib.h>
79
80+#include "gimpintl.h"
81 #include "gimputils.h"
82
83+#define Q_PREFIX_START '!'
84+#define Q_PREFIX_END '!'
85+
86 /**
87 * gimp_strescape:
88 * @source: A string to escape special characters in.
89@@ -197,3 +201,113 @@
90 return dest;
91 }
92 #endif /* GLIB <= 1.3 */
93+
94+/***
95+ * gimp_i18n_qualifier_prefix_gettext
96+ *
97+ **/
98+gchar *
99+gimp_i18n_qualifier_prefix_gettext (const gchar *string)
100+{
101+ g_assert (string != NULL);
102+
103+ if (*string != Q_PREFIX_START) {
104+ return gettext (string);
105+ } else {
106+ gchar *translation;
107+
108+ translation = gettext (string);
109+ if (translation != string) {
110+ if (*translation != Q_PREFIX_START) {
111+ return translation;
112+ } else {
113+ gchar *real_translation;
114+
115+ real_translation = strchr (translation + 1, Q_PREFIX_END);
116+ if (real_translation != NULL) {
117+ return real_translation + 1;
118+ } else {
119+ g_warning ("Ivalid Q_() translation: \"%s\"", translation);
120+ return translation;
121+ }
122+ }
123+ } else {
124+ gchar *real_string;
125+
126+ real_string = strchr (string + 1, Q_PREFIX_END);
127+ if (real_string != NULL) {
128+ return gettext (real_string + 1);
129+ } else {
130+ g_warning ("Ivalid Q_() string: \"%s\"", string);
131+ return (gchar *) string;
132+ }
133+ }
134+ }
135+}
136+
137+/***
138+ * gimp_i18n_qualifier_prefix_dgettext
139+ *
140+ **/
141+gchar *
142+gimp_i18n_qualifier_prefix_dgettext (const gchar *domain, const gchar *string)
143+{
144+ g_assert (string != NULL);
145+
146+ if (*string != Q_PREFIX_START) {
147+ return dgettext (domain, string);
148+ } else {
149+ gchar *translation;
150+
151+ translation = dgettext (domain, string);
152+ if (translation != string) {
153+ if (*translation != Q_PREFIX_START) {
154+ return translation;
155+ } else {
156+ gchar *real_translation;
157+
158+ real_translation = strchr (translation + 1, Q_PREFIX_END);
159+ if (real_translation != NULL) {
160+ return real_translation + 1;
161+ } else {
162+ g_warning ("Ivalid Q_() translation: \"%s\"", translation);
163+ return translation;
164+ }
165+ }
166+ } else {
167+ gchar *real_string;
168+
169+ real_string = strchr (string + 1, Q_PREFIX_END);
170+ if (real_string != NULL) {
171+ return dgettext (domain, real_string + 1);
172+ } else {
173+ g_warning ("Ivalid Q_() string: \"%s\"", string);
174+ return (gchar *) string;
175+ }
176+ }
177+ }
178+}
179+
180+/***
181+ * gimp_i18n_qualifier_prefix_noop
182+ *
183+ **/
184+gchar *
185+gimp_i18n_qualifier_prefix_noop (const gchar *string)
186+{
187+ g_assert (string != NULL);
188+
189+ if (*string != Q_PREFIX_START) {
190+ return (gchar *) string;
191+ } else {
192+ gchar *real_string;
193+
194+ real_string = strchr (string + 1, Q_PREFIX_END);
195+ if (real_string != NULL) {
196+ return real_string + 1;
197+ } else {
198+ g_warning ("Ivalid Q_() string: \"%s\"", string);
199+ return (gchar *) string;
200+ }
201+ }
202+}
203diff -ruN /home/cyba/gcvs/gimp/po/Makefile.in.in.i18npatch gimp/po/Makefile.in.in.i18npatch
204--- /home/cyba/gcvs/gimp/po/Makefile.in.in.i18npatch Thu Jan 1 01:00:00 1970
205+++ gimp/po/Makefile.in.in.i18npatch Wed Dec 6 19:35:34 2000
206@@ -0,0 +1,9 @@
207+--- Makefile.in.in.clean Wed Dec 6 19:33:55 2000
208++++ Makefile.in.in Wed Dec 6 19:32:58 2000
209+@@ -87,5 +87,5 @@
210+ $(srcdir)/$(PACKAGE).pot: $(POTFILES)
211+ $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
212+- --add-comments --keyword=_ --keyword=N_ \
213++ --add-comments --keyword=_ --keyword=N_ --keyword=Q_ \
214+ --files-from=$(srcdir)/POTFILES.in \
215+ && test ! -f $(PACKAGE).po \
216diff -ruN /home/cyba/gcvs/gimp/po-libgimp/Makefile.in.in gimp/po-libgimp/Makefile.in.in
217--- /home/cyba/gcvs/gimp/po-libgimp/Makefile.in.in Thu Nov 23 12:39:17 2000
218+++ gimp/po-libgimp/Makefile.in.in Wed Dec 6 19:32:58 2000
219@@ -84,7 +84,7 @@
220
221 $(srcdir)/$(PACKAGE).pot: $(POTFILES)
222 $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
223- --add-comments --keyword=_ --keyword=N_ \
224+ --add-comments --keyword=_ --keyword=N_ --keyword=Q_ \
225 --files-from=$(srcdir)/POTFILES.in \
226 && test ! -f $(PACKAGE).po \
227 || ( rm -f $(srcdir)/$(PACKAGE).pot \
228diff -ruN /home/cyba/gcvs/gimp/po-plug-ins/Makefile.in.in gimp/po-plug-ins/Makefile.in.in
229--- /home/cyba/gcvs/gimp/po-plug-ins/Makefile.in.in Thu Nov 23 12:39:17 2000
230+++ gimp/po-plug-ins/Makefile.in.in Wed Dec 6 19:32:58 2000
231@@ -84,7 +84,7 @@
232
233 $(srcdir)/$(PACKAGE).pot: $(POTFILES)
234 $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
235- --add-comments --keyword=_ --keyword=N_ \
236+ --add-comments --keyword=_ --keyword=N_ --keyword=Q_ \
237 --files-from=$(srcdir)/POTFILES.in \
238 && test ! -f $(PACKAGE).po \
239 || ( rm -f $(srcdir)/$(PACKAGE).pot \
This page took 0.264643 seconds and 4 git commands to generate.