2 * Copyright (c) 2010-2011 Ævar Arnfjörð Bjarmason
4 * This is a skeleton no-op implementation of gettext for Git.
5 * You can replace it with something that uses libintl.h and wraps
6 * gettext() to try out the translations.
12 #if defined(_) || defined(Q_)
13 #error "namespace conflict: '_' or 'Q_' is pre-defined?"
22 # define gettext(s) (s)
26 # define ngettext(s, p, n) ((n == 1) ? (s) : (p))
29 #define FORMAT_PRESERVING(n) __attribute__((format_arg(n)))
32 extern void git_setup_gettext(void);
33 extern int gettext_width(const char *s
);
35 static inline void git_setup_gettext(void)
38 static inline int gettext_width(const char *s
)
45 extern int use_gettext_poison(void);
47 #define use_gettext_poison() 0
50 static inline FORMAT_PRESERVING(1) const char *_(const char *msgid
)
52 return use_gettext_poison() ? "# GETTEXT POISON #" : gettext(msgid
);
55 static inline FORMAT_PRESERVING(1) FORMAT_PRESERVING(2)
56 const char *Q_(const char *msgid
, const char *plu
, unsigned long n
)
58 if (use_gettext_poison())
59 return "# GETTEXT POISON #";
60 return ngettext(msgid
, plu
, n
);
63 /* Mark msgid for translation but do not translate it. */
64 #define N_(msgid) msgid