bug-gnulib
[Top][All Lists]
Advanced

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

gettext.h: support for libraries


From: Bruno Haible
Subject: gettext.h: support for libraries
Date: Tue, 17 Oct 2006 14:48:36 +0200
User-agent: KMail/1.9.1

Hi,

I added this support for libraries to gettext.h, in sync with GNU gettext.


2006-10-17  Bruno Haible  <address@hidden>

        * lib/gettext.h (gettext, ngettext, pgettext, npgettext): Define
        differently if DEFAULT_TEXT_DOMAIN is set.

diff -r -c3 --exclude='*.po*' --exclude='*.info*' --exclude='*_*.html' 
--exclude='*.*.html' --exclude='*.[13]' --exclude='*.1.in' 
--exclude=Makefile.in --exclude=aclocal.m4 --exclude=configure 
--exclude=version.texi --exclude=stamp-vti --exclude='po-*-gen*.[ch]' 
--exclude='*.o' --exclude='*.lo' --exclude='*.gmo' --exclude=ABOUT-NLS 
--exclude=gnulib-lib --exclude=gnulib-m4 --exclude='javadoc[12]' --exclude=CVS 
gettext-cvs/gnulib-local/lib/gettext.h gettext-6/gnulib-local/lib/gettext.h
*** lib/gettext.h       Sun Jun  4 17:45:00 2006
--- lib/gettext.h       Tue Oct 17 12:50:25 2006
***************
*** 25,30 ****
--- 25,42 ----
  /* Get declarations of GNU message catalog functions.  */
  # include <libintl.h>
  
+ /* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by
+    the gettext() and ngettext() macros.  This is an alternative to calling
+    textdomain(), and is useful for libraries.  */
+ # ifdef DEFAULT_TEXT_DOMAIN
+ #  undef gettext
+ #  define gettext(Msgid) \
+      dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
+ #  undef ngettext
+ #  define ngettext(Msgid1, Msgid2, N) \
+      dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
+ # endif
+ 
  #else
  
  /* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
***************
*** 83,96 ****
     MSGID.  MSGCTXT and MSGID must be string literals.  MSGCTXT should be
     short and rarely need to change.
     The letter 'p' stands for 'particular' or 'special'.  */
! #define pgettext(Msgctxt, Msgid) \
!   pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
  #define dpgettext(Domainname, Msgctxt, Msgid) \
    pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, 
LC_MESSAGES)
  #define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
    pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, 
Category)
! #define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
!   npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, 
MsgidPlural, N, LC_MESSAGES)
  #define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
    npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, 
MsgidPlural, N, LC_MESSAGES)
  #define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
--- 95,118 ----
     MSGID.  MSGCTXT and MSGID must be string literals.  MSGCTXT should be
     short and rarely need to change.
     The letter 'p' stands for 'particular' or 'special'.  */
! #ifdef DEFAULT_TEXT_DOMAIN
! # define pgettext(Msgctxt, Msgid) \
!    pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, 
Msgid, LC_MESSAGES)
! #else
! # define pgettext(Msgctxt, Msgid) \
!    pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
! #endif
  #define dpgettext(Domainname, Msgctxt, Msgid) \
    pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, 
LC_MESSAGES)
  #define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
    pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, 
Category)
! #ifdef DEFAULT_TEXT_DOMAIN
! # define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
!    npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, 
Msgid, MsgidPlural, N, LC_MESSAGES)
! #else
! # define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
!    npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, 
MsgidPlural, N, LC_MESSAGES)
! #endif
  #define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
    npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, 
MsgidPlural, N, LC_MESSAGES)
  #define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \




reply via email to

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