|
version 1.1, 2012/02/21 22:57:48
|
version 1.1.1.2, 2012/05/29 09:29:43
|
|
Line 1
|
Line 1
|
| /* Convenience header for conditional use of GNU <libintl.h>. |
/* Convenience header for conditional use of GNU <libintl.h>. |
| Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009 Free Software Foundation, Inc. | Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2011 Free Software |
| | Foundation, Inc. |
| |
|
| This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
|
Line 53
|
Line 54
|
| it now, to make later inclusions of <libintl.h> a NOP. */ |
it now, to make later inclusions of <libintl.h> a NOP. */ |
| #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) |
#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) |
| # include <cstdlib> |
# include <cstdlib> |
| # if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H | # if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H |
| # include <libintl.h> |
# include <libintl.h> |
| # endif |
# endif |
| #endif |
#endif |
|
Line 80
|
Line 81
|
| ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) |
((void) (Domainname), ngettext (Msgid1, Msgid2, N)) |
| # undef dcngettext |
# undef dcngettext |
| # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ |
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ |
| ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N)) | ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N)) |
| # undef textdomain |
# undef textdomain |
| # define textdomain(Domainname) ((const char *) (Domainname)) |
# define textdomain(Domainname) ((const char *) (Domainname)) |
| # undef bindtextdomain |
# undef bindtextdomain |
|
Line 92
|
Line 93
|
| |
|
| #endif |
#endif |
| |
|
| |
/* Prefer gnulib's setlocale override over libintl's setlocale override. */ |
| |
#ifdef GNULIB_defined_setlocale |
| |
# undef setlocale |
| |
# define setlocale rpl_setlocale |
| |
#endif |
| |
|
| /* A pseudo function call that serves as a marker for the automated |
/* A pseudo function call that serves as a marker for the automated |
| extraction of messages, but does not call gettext(). The run-time |
extraction of messages, but does not call gettext(). The run-time |
| translation is done at a different place in the code. |
translation is done at a different place in the code. |
|
Line 140 inline
|
Line 147 inline
|
| #endif |
#endif |
| static const char * |
static const char * |
| pgettext_aux (const char *domain, |
pgettext_aux (const char *domain, |
| const char *msg_ctxt_id, const char *msgid, | const char *msg_ctxt_id, const char *msgid, |
| int category) | int category) |
| { |
{ |
| const char *translation = dcgettext (domain, msg_ctxt_id, category); |
const char *translation = dcgettext (domain, msg_ctxt_id, category); |
| if (translation == msg_ctxt_id) |
if (translation == msg_ctxt_id) |
|
Line 159 inline
|
Line 166 inline
|
| #endif |
#endif |
| static const char * |
static const char * |
| npgettext_aux (const char *domain, |
npgettext_aux (const char *domain, |
| const char *msg_ctxt_id, const char *msgid, | const char *msg_ctxt_id, const char *msgid, |
| const char *msgid_plural, unsigned long int n, | const char *msgid_plural, unsigned long int n, |
| int category) | int category) |
| { |
{ |
| const char *translation = |
const char *translation = |
| dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); |
dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); |
|
Line 199 inline
|
Line 206 inline
|
| #endif |
#endif |
| static const char * |
static const char * |
| dcpgettext_expr (const char *domain, |
dcpgettext_expr (const char *domain, |
| const char *msgctxt, const char *msgid, | const char *msgctxt, const char *msgid, |
| int category) | int category) |
| { |
{ |
| size_t msgctxt_len = strlen (msgctxt) + 1; |
size_t msgctxt_len = strlen (msgctxt) + 1; |
| size_t msgid_len = strlen (msgid) + 1; |
size_t msgid_len = strlen (msgid) + 1; |
|
Line 222 dcpgettext_expr (const char *domain,
|
Line 229 dcpgettext_expr (const char *domain,
|
| translation = dcgettext (domain, msg_ctxt_id, category); |
translation = dcgettext (domain, msg_ctxt_id, category); |
| #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
| if (msg_ctxt_id != buf) |
if (msg_ctxt_id != buf) |
| free (msg_ctxt_id); | free (msg_ctxt_id); |
| #endif |
#endif |
| if (translation != msg_ctxt_id) |
if (translation != msg_ctxt_id) |
| return translation; | return translation; |
| } |
} |
| return msgid; |
return msgid; |
| } |
} |
|
Line 244 inline
|
Line 251 inline
|
| #endif |
#endif |
| static const char * |
static const char * |
| dcnpgettext_expr (const char *domain, |
dcnpgettext_expr (const char *domain, |
| const char *msgctxt, const char *msgid, | const char *msgctxt, const char *msgid, |
| const char *msgid_plural, unsigned long int n, | const char *msgid_plural, unsigned long int n, |
| int category) | int category) |
| { |
{ |
| size_t msgctxt_len = strlen (msgctxt) + 1; |
size_t msgctxt_len = strlen (msgctxt) + 1; |
| size_t msgid_len = strlen (msgid) + 1; |
size_t msgid_len = strlen (msgid) + 1; |
|
Line 268 dcnpgettext_expr (const char *domain,
|
Line 275 dcnpgettext_expr (const char *domain,
|
| translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); |
translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); |
| #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
| if (msg_ctxt_id != buf) |
if (msg_ctxt_id != buf) |
| free (msg_ctxt_id); | free (msg_ctxt_id); |
| #endif |
#endif |
| if (!(translation == msg_ctxt_id || translation == msgid_plural)) |
if (!(translation == msg_ctxt_id || translation == msgid_plural)) |
| return translation; | return translation; |
| } |
} |
| return (n == 1 ? msgid : msgid_plural); |
return (n == 1 ? msgid : msgid_plural); |
| } |
} |