Skip to content

Commit 0c3a433

Browse files
trastgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 54e6dc7 commit 0c3a433

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

gettext.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ extern int use_gettext_poison(void);
4444

4545
static inline FORMAT_PRESERVING(1) const char *_(const char *msgid)
4646
{
47+
if (!*msgid)
48+
return "";
4749
return use_gettext_poison() ? "# GETTEXT POISON #" : gettext(msgid);
4850
}
4951

0 commit comments

Comments
 (0)