2011-02-23 00:41:20 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2010-2011 Ævar Arnfjörð Bjarmason
|
|
|
|
*
|
|
|
|
* This is a skeleton no-op implementation of gettext for Git.
|
|
|
|
* You can replace it with something that uses libintl.h and wraps
|
|
|
|
* gettext() to try out the translations.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GETTEXT_H
|
|
|
|
#define GETTEXT_H
|
|
|
|
|
2011-03-10 04:17:58 +01:00
|
|
|
#if defined(_) || defined(Q_)
|
|
|
|
#error "namespace conflict: '_' or 'Q_' is pre-defined?"
|
2011-02-23 00:41:20 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define FORMAT_PRESERVING(n) __attribute__((format_arg(n)))
|
|
|
|
|
2011-02-23 00:41:21 +01:00
|
|
|
#ifdef GETTEXT_POISON
|
2011-02-23 00:41:22 +01:00
|
|
|
extern int use_gettext_poison(void);
|
2011-02-23 00:41:21 +01:00
|
|
|
#else
|
|
|
|
#define use_gettext_poison() 0
|
|
|
|
#endif
|
|
|
|
|
2011-02-23 00:41:20 +01:00
|
|
|
static inline FORMAT_PRESERVING(1) const char *_(const char *msgid)
|
|
|
|
{
|
2011-02-23 00:41:21 +01:00
|
|
|
return use_gettext_poison() ? "# GETTEXT POISON #" : msgid;
|
2011-02-23 00:41:20 +01:00
|
|
|
}
|
|
|
|
|
2011-03-10 04:17:58 +01:00
|
|
|
static inline FORMAT_PRESERVING(1) FORMAT_PRESERVING(2)
|
|
|
|
const char *Q_(const char *msgid, const char *plu, unsigned long n)
|
|
|
|
{
|
|
|
|
if (use_gettext_poison())
|
|
|
|
return "# GETTEXT POISON #";
|
|
|
|
return n == 1 ? msgid : plu;
|
|
|
|
}
|
|
|
|
|
2011-02-23 00:41:20 +01:00
|
|
|
/* Mark msgid for translation but do not translate it. */
|
2011-04-07 20:41:48 +02:00
|
|
|
#define N_(msgid) msgid
|
2011-02-23 00:41:20 +01:00
|
|
|
|
|
|
|
#endif
|