summaryrefslogtreecommitdiff
path: root/gettext.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2011-02-22 23:41:22 +0000
committerJunio C Hamano <gitster@pobox.com>2011-03-08 12:10:03 -0800
commit309552295af4b0f2ddd1af15d919441b1744523a (patch)
tree7ea1908eee1415108fe6f96f527c51e5d1f2dfc5 /gettext.c
parentbb946bba761288e24b3eb621a3782a4fa804f21d (diff)
downloadgit-309552295af4b0f2ddd1af15d919441b1744523a.tar.gz
i18n: do not poison translations unless GIT_GETTEXT_POISON envvar is set
Tweak the GETTEXT_POISON facility so it is activated at run time instead of compile time. If the GIT_GETTEXT_POISON environment variable is set, _(msg) will result in gibberish as before; but if the GIT_GETTEXT_POISON variable is not set, it will return the message for human-readable output. So the behavior of mistranslated and untranslated git can be compared without rebuilding git in between. For simplicity we always set the GIT_GETTEXT_POISON variable in tests. This does not affect builds without the GETTEXT_POISON compile-time option set, so non-i18n git will not be slowed down. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gettext.c')
-rw-r--r--gettext.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gettext.c b/gettext.c
new file mode 100644
index 0000000000..ae5394a496
--- /dev/null
+++ b/gettext.c
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2010 Ævar Arnfjörð Bjarmason
+ */
+
+#include "git-compat-util.h"
+#include "gettext.h"
+
+int use_gettext_poison(void)
+{
+ static int poison_requested = -1;
+ if (poison_requested == -1)
+ poison_requested = getenv("GIT_GETTEXT_POISON") ? 1 : 0;
+ return poison_requested;
+}