Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] parseopt: do not translate empty help string

From: Thomas Rast <hidden>
Date: 2016-06-15 22:54:32

Junio C Hamano [off-list ref] writes:
Junio C Hamano [off-list ref] writes:
quoted
quoted
Oh, I forgot that we actually had a wrapper instead of the usual _.
Yes, I think that would be the better solution to guard against this.
OK, then let's replace the patch text of your commit ;-).
He, we need to update the log message a bit, too.
Thanks!  But now it's your patch :-)
-- >8 --
From: Thomas Rast <redacted>
Subject: [PATCH] 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.

Prevent us from passing empty strings to gettext.  In some places,
          ^^

ourselves?  I'm not a native speaker though.
quoted hunk
we run _(opts->help) where opts->help may be an empty string.

Signed-off-by: Thomas Rast <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
 gettext.h | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/gettext.h b/gettext.h
index 57ba8bb..376297b 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);
 }
-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help