git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Thomas Rast <trast@student.ethz.ch>
Cc: git@vger.kernel.org, "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: Re: [PATCH] parseopt: do not translate empty help string
Date: Mon, 20 Aug 2012 15:08:23 -0700	[thread overview]
Message-ID: <7vvcgdi5d4.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7vzk5pi5jn.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Mon, 20 Aug 2012 15:04:28 -0700")

Junio C Hamano <gitster@pobox.com> writes:

>> 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.

-- >8 --
From: Thomas Rast <trast@student.ethz.ch>
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,
we run _(opts->help) where opts->help may be an empty string.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 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);
 }
 
-- 
1.7.12.124.ga484625

  reply	other threads:[~2012-08-20 22:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-20 18:24 [PATCH] parseopt: do not translate empty help string Thomas Rast
2012-08-20 19:21 ` Junio C Hamano
2012-08-20 20:10   ` Thomas Rast
2012-08-20 22:04     ` Junio C Hamano
2012-08-20 22:08       ` Junio C Hamano [this message]
2012-08-20 23:03         ` Thomas Rast

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vvcgdi5d4.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    --cc=trast@student.ethz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).