git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Thomas Rast <trast@student.ethz.ch>
Date
Aug 20, 2012, 20:10 UTC
Message-ID
<87obm5jpdy.fsf@thomas.inf.ethz.ch>
In-Reply-To
<7vboi5jrn1.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 26 quoted lines
> Thomas Rast <trast@student.ethz.ch> writes:
>
>> 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.
>
> Thanks; this is a tricky bit to catch and makes me wonder where else
> we have a similar breakage.
>
> Perhaps we would want to do this instead?  I dunno.
>
>  gettext.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git i/gettext.h w/gettext.h
> index 57ba8bb..376297b 100644
> --- i/gettext.h
> +++ w/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);
>  }

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.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 6 in “parseopt: do not translate empty help string”
  1. parseopt: do not translate empty help stringThomas Rast, Aug 20, 2012
  2. Junio C HamanoAug 20, 2012
  3. Thomas RastAug 20, 2012
  4. Junio C HamanoAug 20, 2012
  5. Junio C HamanoAug 20, 2012
  6. Thomas RastAug 20, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.