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>
Thomas Rast committed
Aug 20, 2012 at 20:24 UTC
0c3a433f94d6809bd6c81ef3bd5c5315c844aa5d
1 file changed
+2
gettext.h
+2
@@ -44,6 +44,8 @@ extern int use_gettext_poison(void);
44
45
static inline FORMAT_PRESERVING(1) const char *_(const char *msgid)
46
{
47
+ if (!*msgid)
48
+ return "";
49
return use_gettext_poison() ? "# GETTEXT POISON #" : gettext(msgid);
50
}
51