|
|
@@ -1,24 +1,26 @@ |
|
|
|
/* Convenience header for conditional use of GNU <libintl.h>. |
|
|
|
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2011 Free Software Foundation, Inc. |
|
|
|
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2018 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 |
|
|
|
the Free Software Foundation; either version 3 of the License, or |
|
|
|
(at your option) any later version. |
|
|
|
the Free Software Foundation; either version 2, or (at your option) |
|
|
|
any later version. |
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
|
GNU General Public License for more details. |
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
|
|
|
You should have received a copy of the GNU General Public License along |
|
|
|
with this program; if not, see <https://www.gnu.org/licenses/>. */ |
|
|
|
|
|
|
|
#ifndef _LIBGETTEXT_H |
|
|
|
#define _LIBGETTEXT_H 1 |
|
|
|
|
|
|
|
/* NLS can be disabled through the configure --disable-nls option. */ |
|
|
|
#if ENABLE_NLS |
|
|
|
/* NLS can be disabled through the configure --disable-nls option |
|
|
|
or through "#define ENABLE NLS 0" before including this file. */ |
|
|
|
#if defined ENABLE_NLS && ENABLE_NLS |
|
|
|
|
|
|
|
/* Get declarations of GNU message catalog functions. */ |
|
|
|
# include <libintl.h> |
|
|
@@ -183,7 +185,8 @@ npgettext_aux (const char *domain, |
|
|
|
#include <string.h> |
|
|
|
|
|
|
|
#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \ |
|
|
|
/* || __STDC_VERSION__ >= 199901L */ ) |
|
|
|
/* || __STDC_VERSION__ == 199901L |
|
|
|
|| (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ ) |
|
|
|
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1 |
|
|
|
#else |
|
|
|
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0 |
|
|
@@ -224,15 +227,17 @@ dcpgettext_expr (const char *domain, |
|
|
|
if (msg_ctxt_id != NULL) |
|
|
|
#endif |
|
|
|
{ |
|
|
|
int found_translation; |
|
|
|
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); |
|
|
|
msg_ctxt_id[msgctxt_len - 1] = '\004'; |
|
|
|
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); |
|
|
|
translation = dcgettext (domain, msg_ctxt_id, category); |
|
|
|
found_translation = (translation != msg_ctxt_id); |
|
|
|
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
|
|
|
if (msg_ctxt_id != buf) |
|
|
|
free (msg_ctxt_id); |
|
|
|
#endif |
|
|
|
if (translation != msg_ctxt_id) |
|
|
|
if (found_translation) |
|
|
|
return translation; |
|
|
|
} |
|
|
|
return msgid; |
|
|
@@ -270,15 +275,17 @@ dcnpgettext_expr (const char *domain, |
|
|
|
if (msg_ctxt_id != NULL) |
|
|
|
#endif |
|
|
|
{ |
|
|
|
int found_translation; |
|
|
|
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); |
|
|
|
msg_ctxt_id[msgctxt_len - 1] = '\004'; |
|
|
|
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); |
|
|
|
translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); |
|
|
|
found_translation = !(translation == msg_ctxt_id || translation == msgid_plural); |
|
|
|
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
|
|
|
if (msg_ctxt_id != buf) |
|
|
|
free (msg_ctxt_id); |
|
|
|
#endif |
|
|
|
if (!(translation == msg_ctxt_id || translation == msgid_plural)) |
|
|
|
if (found_translation) |
|
|
|
return translation; |
|
|
|
} |
|
|
|
return (n == 1 ? msgid : msgid_plural); |