Upgrade gettext infrastructure.
authorAkos Ladanyi <ladanyi@tmit.bme.hu>
Thu, 10 Jul 2008 20:38:53 +0100
changeset 5390d05b2d25c
parent 4 244d8c60b997
child 6 3a44a2bb6da8
Upgrade gettext infrastructure.
ChangeLog
Makefile.am
configure.ac
gettext.h
graph-displayer.cc
m4/ChangeLog
m4/Makefile.am
po/ChangeLog
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ChangeLog	Thu Jul 10 20:38:53 2008 +0100
     1.3 @@ -0,0 +1,7 @@
     1.4 +2008-07-10  gettextize  <bug-gnu-gettext@gnu.org>
     1.5 +
     1.6 +	* Makefile.am (ACLOCAL_AMFLAGS): New variable.
     1.7 +	(EXTRA_DIST): Add build-aux/config.rpath.
     1.8 +	* configure.ac (AC_CONFIG_FILES): Add po/Makefile.in.
     1.9 +	(AM_GNU_GETTEXT_VERSION): Bump to 0.17.
    1.10 +
     2.1 --- a/Makefile.am	Thu Jul 10 18:53:00 2008 +0100
     2.2 +++ b/Makefile.am	Thu Jul 10 20:38:53 2008 +0100
     2.3 @@ -1,5 +1,7 @@
     2.4  AM_CPPFLAGS = -I$(top_srcdir) -DLOCALEDIR=\""$(datadir)/locale"\"
     2.5  
     2.6 +ACLOCAL_AMFLAGS = -I m4
     2.7 +
     2.8  SUBDIRS = po m4
     2.9  
    2.10  bin_PROGRAMS = glemon
    2.11 @@ -102,7 +104,8 @@
    2.12  	LICENSE \
    2.13  	NEWS \
    2.14  	README \
    2.15 -	ABOUT-NLS
    2.16 +	ABOUT-NLS \
    2.17 +	build-aux/config.rpath
    2.18  
    2.19  MRPROPERFILES = \
    2.20  	Makefile.in \
     3.1 --- a/configure.ac	Thu Jul 10 18:53:00 2008 +0100
     3.2 +++ b/configure.ac	Thu Jul 10 20:38:53 2008 +0100
     3.3 @@ -20,7 +20,7 @@
     3.4  dnl Checks for programs.
     3.5  AC_PROG_CXX
     3.6  AC_PROG_CC
     3.7 -AM_GNU_GETTEXT_VERSION([0.14.2])
     3.8 +AM_GNU_GETTEXT_VERSION([0.17])
     3.9  AM_GNU_GETTEXT([external])
    3.10  
    3.11  dnl Checks for libraries.
     4.1 --- a/gettext.h	Thu Jul 10 18:53:00 2008 +0100
     4.2 +++ b/gettext.h	Thu Jul 10 20:38:53 2008 +0100
     4.3 @@ -1,8 +1,8 @@
     4.4  /* Convenience header for conditional use of GNU <libintl.h>.
     4.5 -   Copyright (C) 1995-1998, 2000-2002, 2004 Free Software Foundation, Inc.
     4.6 +   Copyright (C) 1995-1998, 2000-2002, 2004-2006 Free Software Foundation, Inc.
     4.7  
     4.8     This program is free software; you can redistribute it and/or modify it
     4.9 -   under the terms of the GNU Library General Public License as published
    4.10 +   under the terms of the GNU General Public License as published
    4.11     by the Free Software Foundation; either version 2, or (at your option)
    4.12     any later version.
    4.13  
    4.14 @@ -11,7 +11,7 @@
    4.15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    4.16     Library General Public License for more details.
    4.17  
    4.18 -   You should have received a copy of the GNU Library General Public
    4.19 +   You should have received a copy of the GNU General Public
    4.20     License along with this program; if not, write to the Free Software
    4.21     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
    4.22     USA.  */
    4.23 @@ -25,6 +25,18 @@
    4.24  /* Get declarations of GNU message catalog functions.  */
    4.25  # include <libintl.h>
    4.26  
    4.27 +/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by
    4.28 +   the gettext() and ngettext() macros.  This is an alternative to calling
    4.29 +   textdomain(), and is useful for libraries.  */
    4.30 +# ifdef DEFAULT_TEXT_DOMAIN
    4.31 +#  undef gettext
    4.32 +#  define gettext(Msgid) \
    4.33 +     dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
    4.34 +#  undef ngettext
    4.35 +#  define ngettext(Msgid1, Msgid2, N) \
    4.36 +     dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
    4.37 +# endif
    4.38 +
    4.39  #else
    4.40  
    4.41  /* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
    4.42 @@ -53,17 +65,22 @@
    4.43     On pre-ANSI systems without 'const', the config.h file is supposed to
    4.44     contain "#define const".  */
    4.45  # define gettext(Msgid) ((const char *) (Msgid))
    4.46 -# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
    4.47 -# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
    4.48 +# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
    4.49 +# define dcgettext(Domainname, Msgid, Category) \
    4.50 +    ((void) (Category), dgettext (Domainname, Msgid))
    4.51  # define ngettext(Msgid1, Msgid2, N) \
    4.52 -    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
    4.53 +    ((N) == 1 \
    4.54 +     ? ((void) (Msgid2), (const char *) (Msgid1)) \
    4.55 +     : ((void) (Msgid1), (const char *) (Msgid2)))
    4.56  # define dngettext(Domainname, Msgid1, Msgid2, N) \
    4.57 -    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
    4.58 +    ((void) (Domainname), ngettext (Msgid1, Msgid2, N))
    4.59  # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
    4.60 -    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
    4.61 +    ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N))
    4.62  # define textdomain(Domainname) ((const char *) (Domainname))
    4.63 -# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
    4.64 -# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
    4.65 +# define bindtextdomain(Domainname, Dirname) \
    4.66 +    ((void) (Domainname), (const char *) (Dirname))
    4.67 +# define bind_textdomain_codeset(Domainname, Codeset) \
    4.68 +    ((void) (Domainname), (const char *) (Codeset))
    4.69  
    4.70  #endif
    4.71  
    4.72 @@ -76,4 +93,179 @@
    4.73     initializer for static 'char[]' or 'const char[]' variables.  */
    4.74  #define gettext_noop(String) String
    4.75  
    4.76 +/* The separator between msgctxt and msgid in a .mo file.  */
    4.77 +#define GETTEXT_CONTEXT_GLUE "\004"
    4.78 +
    4.79 +/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a
    4.80 +   MSGID.  MSGCTXT and MSGID must be string literals.  MSGCTXT should be
    4.81 +   short and rarely need to change.
    4.82 +   The letter 'p' stands for 'particular' or 'special'.  */
    4.83 +#ifdef DEFAULT_TEXT_DOMAIN
    4.84 +# define pgettext(Msgctxt, Msgid) \
    4.85 +   pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
    4.86 +#else
    4.87 +# define pgettext(Msgctxt, Msgid) \
    4.88 +   pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
    4.89 +#endif
    4.90 +#define dpgettext(Domainname, Msgctxt, Msgid) \
    4.91 +  pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
    4.92 +#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
    4.93 +  pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
    4.94 +#ifdef DEFAULT_TEXT_DOMAIN
    4.95 +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
    4.96 +   npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
    4.97 +#else
    4.98 +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
    4.99 +   npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
   4.100 +#endif
   4.101 +#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
   4.102 +  npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
   4.103 +#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
   4.104 +  npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
   4.105 +
   4.106 +#ifdef __GNUC__
   4.107 +__inline
   4.108 +#else
   4.109 +#ifdef __cplusplus
   4.110 +inline
   4.111 +#endif
   4.112 +#endif
   4.113 +static const char *
   4.114 +pgettext_aux (const char *domain,
   4.115 +	      const char *msg_ctxt_id, const char *msgid,
   4.116 +	      int category)
   4.117 +{
   4.118 +  const char *translation = dcgettext (domain, msg_ctxt_id, category);
   4.119 +  if (translation == msg_ctxt_id)
   4.120 +    return msgid;
   4.121 +  else
   4.122 +    return translation;
   4.123 +}
   4.124 +
   4.125 +#ifdef __GNUC__
   4.126 +__inline
   4.127 +#else
   4.128 +#ifdef __cplusplus
   4.129 +inline
   4.130 +#endif
   4.131 +#endif
   4.132 +static const char *
   4.133 +npgettext_aux (const char *domain,
   4.134 +	       const char *msg_ctxt_id, const char *msgid,
   4.135 +	       const char *msgid_plural, unsigned long int n,
   4.136 +	       int category)
   4.137 +{
   4.138 +  const char *translation =
   4.139 +    dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
   4.140 +  if (translation == msg_ctxt_id || translation == msgid_plural)
   4.141 +    return (n == 1 ? msgid : msgid_plural);
   4.142 +  else
   4.143 +    return translation;
   4.144 +}
   4.145 +
   4.146 +/* The same thing extended for non-constant arguments.  Here MSGCTXT and MSGID
   4.147 +   can be arbitrary expressions.  But for string literals these macros are
   4.148 +   less efficient than those above.  */
   4.149 +
   4.150 +#include <string.h>
   4.151 +
   4.152 +#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
   4.153 +  (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \
   4.154 +   /* || __STDC_VERSION__ >= 199901L */ )
   4.155 +
   4.156 +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
   4.157 +#include <stdlib.h>
   4.158 +#endif
   4.159 +
   4.160 +#define pgettext_expr(Msgctxt, Msgid) \
   4.161 +  dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
   4.162 +#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
   4.163 +  dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
   4.164 +
   4.165 +#ifdef __GNUC__
   4.166 +__inline
   4.167 +#else
   4.168 +#ifdef __cplusplus
   4.169 +inline
   4.170 +#endif
   4.171 +#endif
   4.172 +static const char *
   4.173 +dcpgettext_expr (const char *domain,
   4.174 +		 const char *msgctxt, const char *msgid,
   4.175 +		 int category)
   4.176 +{
   4.177 +  size_t msgctxt_len = strlen (msgctxt) + 1;
   4.178 +  size_t msgid_len = strlen (msgid) + 1;
   4.179 +  const char *translation;
   4.180 +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
   4.181 +  char msg_ctxt_id[msgctxt_len + msgid_len];
   4.182 +#else
   4.183 +  char buf[1024];
   4.184 +  char *msg_ctxt_id =
   4.185 +    (msgctxt_len + msgid_len <= sizeof (buf)
   4.186 +     ? buf
   4.187 +     : (char *) malloc (msgctxt_len + msgid_len));
   4.188 +  if (msg_ctxt_id != NULL)
   4.189 +#endif
   4.190 +    {
   4.191 +      memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
   4.192 +      msg_ctxt_id[msgctxt_len - 1] = '\004';
   4.193 +      memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
   4.194 +      translation = dcgettext (domain, msg_ctxt_id, category);
   4.195 +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
   4.196 +      if (msg_ctxt_id != buf)
   4.197 +	free (msg_ctxt_id);
   4.198 +#endif
   4.199 +      if (translation != msg_ctxt_id)
   4.200 +	return translation;
   4.201 +    }
   4.202 +  return msgid;
   4.203 +}
   4.204 +
   4.205 +#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
   4.206 +  dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
   4.207 +#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
   4.208 +  dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
   4.209 +
   4.210 +#ifdef __GNUC__
   4.211 +__inline
   4.212 +#else
   4.213 +#ifdef __cplusplus
   4.214 +inline
   4.215 +#endif
   4.216 +#endif
   4.217 +static const char *
   4.218 +dcnpgettext_expr (const char *domain,
   4.219 +		  const char *msgctxt, const char *msgid,
   4.220 +		  const char *msgid_plural, unsigned long int n,
   4.221 +		  int category)
   4.222 +{
   4.223 +  size_t msgctxt_len = strlen (msgctxt) + 1;
   4.224 +  size_t msgid_len = strlen (msgid) + 1;
   4.225 +  const char *translation;
   4.226 +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
   4.227 +  char msg_ctxt_id[msgctxt_len + msgid_len];
   4.228 +#else
   4.229 +  char buf[1024];
   4.230 +  char *msg_ctxt_id =
   4.231 +    (msgctxt_len + msgid_len <= sizeof (buf)
   4.232 +     ? buf
   4.233 +     : (char *) malloc (msgctxt_len + msgid_len));
   4.234 +  if (msg_ctxt_id != NULL)
   4.235 +#endif
   4.236 +    {
   4.237 +      memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
   4.238 +      msg_ctxt_id[msgctxt_len - 1] = '\004';
   4.239 +      memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
   4.240 +      translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
   4.241 +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
   4.242 +      if (msg_ctxt_id != buf)
   4.243 +	free (msg_ctxt_id);
   4.244 +#endif
   4.245 +      if (!(translation == msg_ctxt_id || translation == msgid_plural))
   4.246 +	return translation;
   4.247 +    }
   4.248 +  return (n == 1 ? msgid : msgid_plural);
   4.249 +}
   4.250 +
   4.251  #endif /* _LIBGETTEXT_H */
     5.1 --- a/graph-displayer.cc	Thu Jul 10 18:53:00 2008 +0100
     5.2 +++ b/graph-displayer.cc	Thu Jul 10 20:38:53 2008 +0100
     5.3 @@ -25,7 +25,7 @@
     5.4  #include <libgnomecanvasmm.h>
     5.5  #include <libgnomecanvasmm/polygon.h>
     5.6  
     5.7 -#include <libintl.h>
     5.8 +#include "gettext.h"
     5.9  
    5.10  #define MAIN_PART
    5.11  
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/m4/ChangeLog	Thu Jul 10 20:38:53 2008 +0100
     6.3 @@ -0,0 +1,12 @@
     6.4 +2008-07-10  gettextize  <bug-gnu-gettext@gnu.org>
     6.5 +
     6.6 +	* gettext.m4: New file, from gettext-0.17.
     6.7 +	* iconv.m4: New file, from gettext-0.17.
     6.8 +	* lib-ld.m4: New file, from gettext-0.17.
     6.9 +	* lib-link.m4: New file, from gettext-0.17.
    6.10 +	* lib-prefix.m4: New file, from gettext-0.17.
    6.11 +	* nls.m4: New file, from gettext-0.17.
    6.12 +	* po.m4: New file, from gettext-0.17.
    6.13 +	* progtest.m4: New file, from gettext-0.17.
    6.14 +	* Makefile.am (EXTRA_DIST): Add the new files.
    6.15 +
     7.1 --- a/m4/Makefile.am	Thu Jul 10 18:53:00 2008 +0100
     7.2 +++ b/m4/Makefile.am	Thu Jul 10 20:38:53 2008 +0100
     7.3 @@ -1,30 +1,9 @@
     7.4  EXTRA_DIST = \
     7.5 -	codeset.m4 \
     7.6  	gettext.m4 \
     7.7 -	glibc21.m4 \
     7.8 -	glibc2.m4 \
     7.9  	iconv.m4 \
    7.10 -	intdiv0.m4 \
    7.11 -	intmax.m4 \
    7.12 -	inttypes_h.m4 \
    7.13 -	inttypes.m4 \
    7.14 -	inttypes-pri.m4 \
    7.15 -	isc-posix.m4 \
    7.16 -	lcmessage.m4 \
    7.17  	lib-ld.m4 \
    7.18  	lib-link.m4 \
    7.19  	lib-prefix.m4 \
    7.20 -	longdouble.m4 \
    7.21 -	longlong.m4 \
    7.22  	nls.m4 \
    7.23  	po.m4 \
    7.24 -	printf-posix.m4 \
    7.25 -	progtest.m4 \
    7.26 -	signed.m4 \
    7.27 -	size_max.m4 \
    7.28 -	stdint_h.m4 \
    7.29 -	uintmax_t.m4 \
    7.30 -	ulonglong.m4 \
    7.31 -	wchar_t.m4 \
    7.32 -	wint_t.m4 \
    7.33 -	xsize.m4
    7.34 +	progtest.m4
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/po/ChangeLog	Thu Jul 10 20:38:53 2008 +0100
     8.3 @@ -0,0 +1,11 @@
     8.4 +2008-07-10  gettextize  <bug-gnu-gettext@gnu.org>
     8.5 +
     8.6 +	* Makefile.in.in: New file, from gettext-0.17.
     8.7 +	* boldquot.sed: New file, from gettext-0.17.
     8.8 +	* en@boldquot.header: New file, from gettext-0.17.
     8.9 +	* en@quot.header: New file, from gettext-0.17.
    8.10 +	* insert-header.sin: New file, from gettext-0.17.
    8.11 +	* quot.sed: New file, from gettext-0.17.
    8.12 +	* remove-potcdate.sin: New file, from gettext-0.17.
    8.13 +	* Rules-quot: New file, from gettext-0.17.
    8.14 +