summaryrefslogtreecommitdiff
path: root/gettext.h
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2011-02-22 23:41:21 +0000
committerJunio C Hamano <gitster@pobox.com>2011-03-08 12:10:03 -0800
commitbb946bba761288e24b3eb621a3782a4fa804f21d (patch)
tree460853074320cad6c8d019af655d0879df204ca5 /gettext.h
parent6578483036695820d05aa7cf482a38169ad321bf (diff)
downloadgit-bb946bba761288e24b3eb621a3782a4fa804f21d.tar.gz
i18n: add GETTEXT_POISON to simulate unfriendly translator
Add a new GETTEXT_POISON compile-time parameter to make _(msg) always return gibberish. So now you can run make GETTEXT_POISON=YesPlease to get a copy of git that functions correctly (one hopes) but produces output that is in nobody's native language at all. This is a debugging aid for people who are working on the i18n part of the system, to make sure that they are not marking plumbing messages that should never be translated with _(). As new strings get marked for translation, naturally a number of tests will be broken in this mode. Tests that depend on output from Porcelain will need to be marked with the new C_LOCALE_OUTPUT test prerequisite. Newly failing tests that do not depend on output from Porcelain would be bugs due to messages that should not have been marked for translation. Note that the string we're using ("# GETTEXT POISON #") intentionally starts the pound sign. Some of Git's tests such as t3404-rebase-interactive.sh rely on interactive editing with a fake editor, and will needlessly break if the message doesn't start with something the interactive editor considers a comment. A future patch will fix fix the underlying cause of that issue by adding "#" characters to the commit advice automatically. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gettext.h')
-rw-r--r--gettext.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/gettext.h b/gettext.h
index 6949d736d5..11d82b0a6e 100644
--- a/gettext.h
+++ b/gettext.h
@@ -15,9 +15,15 @@
#define FORMAT_PRESERVING(n) __attribute__((format_arg(n)))
+#ifdef GETTEXT_POISON
+#define use_gettext_poison() 1
+#else
+#define use_gettext_poison() 0
+#endif
+
static inline FORMAT_PRESERVING(1) const char *_(const char *msgid)
{
- return msgid;
+ return use_gettext_poison() ? "# GETTEXT POISON #" : msgid;
}
/* Mark msgid for translation but do not translate it. */