bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Define gettext msgid context helpers when NLS is disabled


From: Guillem Jover
Subject: [PATCH] Define gettext msgid context helpers when NLS is disabled
Date: Thu, 3 Feb 2011 00:55:48 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

When disabling NLS support in configure with --disable-nls, the build
might fail when using the gettext context related helper functions,
due to undefined LC_MESSAGES. Declare them when !ENABLE_NLS.

---
 lib/gettext.h |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

Another option I guess would be to define LC_MESSAGES to something.
Please review, I've only tested the pgettext function which is the one
we are actually using on dpkg.


diff --git a/lib/gettext.h b/lib/gettext.h
index 4715c9f..80d1556 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -105,6 +105,8 @@
 /* The separator between msgctxt and msgid in a .mo file.  */
 #define GETTEXT_CONTEXT_GLUE "\004"
 
+#if ENABLE_NLS
+
 /* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a
    MSGID.  MSGCTXT and MSGID must be string literals.  MSGCTXT should be
    short and rarely need to change.
@@ -277,4 +279,34 @@ dcnpgettext_expr (const char *domain,
   return (n == 1 ? msgid : msgid_plural);
 }
 
+#else /* ENABLE_NLS */
+
+#define pgettext(Msgctxt, Msgid) ((void) (Msgctxt), gettext (Msgid))
+#define dpgettext(Domainname, Msgctxt, Msgid) \
+  ((void) (Domainname), pgettext (Msgctxt, Msgid))
+#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
+  ((void) (Category), dpgettext (Domainname, Msgctxt, Msgid))
+
+#define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
+  ((void) (Msgctxt), ngettext (Msgid, MsgidPlural, N))
+#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
+  ((void) (Domainname), npgettext (Msgctxt, Msgid, MsgidPlural, N)
+#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
+   ((void) (Category), dnpgettext (Domainname, Msgctxt, Msgid, MsgidPlural, N)
+
+#define pgettext_expr(Msgctxt, Msgid) pgettext (Msgctxt, Msgid)
+#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
+  dpgettext (Domainname, Msgctxt, Msgid)
+#define dcpgettext_expr(Domainname, Msgctxt, Msgid, Category) \
+  dcpgettext (Domainname, Msgctxt, Msgid, Category)
+
+#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
+  npgettext (Msgctxt, Msgid, MsgidPlural, N)
+#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
+  dnpgettext (Domainname, Msgctxt, Msgid, MsgidPlural, N)
+#define dcnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) 
\
+  dcnpgettext (Domainname, Msgctxt, Msgid, MsgidPlural, N, Category)
+
+#endif /* ENABLE_NLS */
+
 #endif /* _LIBGETTEXT_H */
-- 
1.7.2.3



reply via email to

[Prev in Thread] Current Thread [Next in Thread]