i18n: do not poison translations unless GIT_GETTEXT_POISON envvar is set
[git.git] / gettext.h
blob04b5958e2bc94ec64de8250dc303258d9de68df0
1 /*
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.
7 */
9 #ifndef GETTEXT_H
10 #define GETTEXT_H
12 #ifdef _
13 #error "namespace conflict: '_' is pre-defined?"
14 #endif
16 #define FORMAT_PRESERVING(n) __attribute__((format_arg(n)))
18 #ifdef GETTEXT_POISON
19 extern int use_gettext_poison(void);
20 #else
21 #define use_gettext_poison() 0
22 #endif
24 static inline FORMAT_PRESERVING(1) const char *_(const char *msgid)
26 return use_gettext_poison() ? "# GETTEXT POISON #" : msgid;
29 /* Mark msgid for translation but do not translate it. */
30 #define N_(msgid) (msgid)
32 #endif