]> git.ipfire.org Git - thirdparty/git.git/blame - gettext.h
i18n: avoid parenthesized string as array initializer
[thirdparty/git.git] / gettext.h
CommitLineData
65784830
ÆAB
1/*
2 * Copyright (c) 2010-2011 Ævar Arnfjörð Bjarmason
3 *
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 */
8
9#ifndef GETTEXT_H
10#define GETTEXT_H
11
0c9ea33b
JN
12#if defined(_) || defined(Q_)
13#error "namespace conflict: '_' or 'Q_' is pre-defined?"
65784830
ÆAB
14#endif
15
16#define FORMAT_PRESERVING(n) __attribute__((format_arg(n)))
17
bb946bba 18#ifdef GETTEXT_POISON
30955229 19extern int use_gettext_poison(void);
bb946bba
ÆAB
20#else
21#define use_gettext_poison() 0
22#endif
23
65784830
ÆAB
24static inline FORMAT_PRESERVING(1) const char *_(const char *msgid)
25{
bb946bba 26 return use_gettext_poison() ? "# GETTEXT POISON #" : msgid;
65784830
ÆAB
27}
28
0c9ea33b
JN
29static inline FORMAT_PRESERVING(1) FORMAT_PRESERVING(2)
30const char *Q_(const char *msgid, const char *plu, unsigned long n)
31{
32 if (use_gettext_poison())
33 return "# GETTEXT POISON #";
34 return n == 1 ? msgid : plu;
35}
36
65784830 37/* Mark msgid for translation but do not translate it. */
642f85fa 38#define N_(msgid) msgid
65784830
ÆAB
39
40#endif