18 #define _LIBGETTEXT_H 1
29 # ifdef DEFAULT_TEXT_DOMAIN
31 # define gettext(Msgid) \
32 dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
34 # define ngettext(Msgid1, Msgid2, N) \
35 dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
53 #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
55 # if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
66 # define gettext(Msgid) ((const char *) (Msgid))
68 # define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
70 # define dcgettext(Domainname, Msgid, Category) \
71 ((void) (Category), dgettext (Domainname, Msgid))
73 # define ngettext(Msgid1, Msgid2, N) \
75 ? ((void) (Msgid2), (const char *) (Msgid1)) \
76 : ((void) (Msgid1), (const char *) (Msgid2)))
78 # define dngettext(Domainname, Msgid1, Msgid2, N) \
79 ((void) (Domainname), ngettext (Msgid1, Msgid2, N))
81 # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
82 ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N))
84 # define textdomain(Domainname) ((const char *) (Domainname))
85 # undef bindtextdomain
86 # define bindtextdomain(Domainname, Dirname) \
87 ((void) (Domainname), (const char *) (Dirname))
88 # undef bind_textdomain_codeset
89 # define bind_textdomain_codeset(Domainname, Codeset) \
90 ((void) (Domainname), (const char *) (Codeset))
95 #ifdef GNULIB_defined_setlocale
97 # define setlocale rpl_setlocale
107 #define gettext_noop(String) String
110 #define GETTEXT_CONTEXT_GLUE "\004"
116 #ifdef DEFAULT_TEXT_DOMAIN
117 # define pgettext(Msgctxt, Msgid) \
118 pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
120 # define pgettext(Msgctxt, Msgid) \
121 pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
123 #define dpgettext(Domainname, Msgctxt, Msgid) \
124 pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
125 #define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
126 pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
127 #ifdef DEFAULT_TEXT_DOMAIN
128 # define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
129 npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
131 # define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
132 npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
134 #define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
135 npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
136 #define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
137 npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
148 const char *msg_ctxt_id,
const char *msgid,
151 const char *translation =
dcgettext (domain, msg_ctxt_id, category);
152 if (translation == msg_ctxt_id)
167 const char *msg_ctxt_id,
const char *msgid,
168 const char *msgid_plural,
unsigned long int n,
171 const char *translation =
172 dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
173 if (translation == msg_ctxt_id || translation == msgid_plural)
174 return (n == 1 ? msgid : msgid_plural);
185 #if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
187 # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
189 # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
192 #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
196 #define pgettext_expr(Msgctxt, Msgid) \
197 dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
198 #define dpgettext_expr(Domainname, Msgctxt, Msgid) \
199 dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
210 const char *msgctxt,
const char *msgid,
213 size_t msgctxt_len = strlen (msgctxt) + 1;
214 size_t msgid_len = strlen (msgid) + 1;
215 const char *translation;
216 #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
217 char msg_ctxt_id[msgctxt_len + msgid_len];
221 (msgctxt_len + msgid_len <=
sizeof (buf)
223 : (
char *) malloc (msgctxt_len + msgid_len));
224 if (msg_ctxt_id !=
NULL)
227 memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
228 msg_ctxt_id[msgctxt_len - 1] =
'\004';
229 memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
230 translation =
dcgettext (domain, msg_ctxt_id, category);
231 #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
232 if (msg_ctxt_id != buf)
235 if (translation != msg_ctxt_id)
241 #define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
242 dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
243 #define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
244 dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
255 const char *msgctxt,
const char *msgid,
256 const char *msgid_plural,
unsigned long int n,
259 size_t msgctxt_len = strlen (msgctxt) + 1;
260 size_t msgid_len = strlen (msgid) + 1;
261 const char *translation;
262 #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
263 char msg_ctxt_id[msgctxt_len + msgid_len];
267 (msgctxt_len + msgid_len <=
sizeof (buf)
269 : (
char *) malloc (msgctxt_len + msgid_len));
270 if (msg_ctxt_id !=
NULL)
273 memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
274 msg_ctxt_id[msgctxt_len - 1] =
'\004';
275 memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
276 translation =
dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
277 #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
278 if (msg_ctxt_id != buf)
281 if (!(translation == msg_ctxt_id || translation == msgid_plural))
284 return (n == 1 ? msgid : msgid_plural);
static const char * dcnpgettext_expr(const char *domain, const char *msgctxt, const char *msgid, const char *msgid_plural, unsigned long int n, int category)
static const char * pgettext_aux(const char *domain, const char *msg_ctxt_id, const char *msgid, int category)
static const char * npgettext_aux(const char *domain, const char *msg_ctxt_id, const char *msgid, const char *msgid_plural, unsigned long int n, int category)
#define dcngettext(Domainname, Msgid1, Msgid2, N, Category)
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
#define dcgettext(Domainname, Msgid, Category)
static const char * dcpgettext_expr(const char *domain, const char *msgctxt, const char *msgid, int category)