summaryrefslogtreecommitdiff
path: root/gettext.h
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2012-08-20 20:24:56 +0200
committerJunio C Hamano <gitster@pobox.com>2012-08-20 20:57:41 -0700
commit0c3a433f94d6809bd6c81ef3bd5c5315c844aa5d (patch)
tree2e20c1e2a7747280c9637105fccaf807832226f6 /gettext.h
parent54e6dc7daf8e4160d5ec5d2742ae09d416126a1b (diff)
downloadgit-0c3a433f94d6809bd6c81ef3bd5c5315c844aa5d.tar.gz
gettext: do not translate empty string
The gettext .po files have a header, but it looks like the translation specification for an empty string. This results in _("") actually returning that header. Check the input to _() and do not call gettext() on an empty string; in some places, we run _(opts->help) where opts->help may be empty. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gettext.h')
-rw-r--r--gettext.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gettext.h b/gettext.h
index 57ba8bb02e..376297bf73 100644
--- a/gettext.h
+++ b/gettext.h
@@ -44,6 +44,8 @@ extern int use_gettext_poison(void);
static inline FORMAT_PRESERVING(1) const char *_(const char *msgid)
{
+ if (!*msgid)
+ return "";
return use_gettext_poison() ? "# GETTEXT POISON #" : gettext(msgid);
}