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

Re: [PATCH] git-gui-i18n: Fix translation of the context menu

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jul 23, 2007, 03:51 UTC
Message-ID
<20070723035122.GB32566@spearce.org>
In-Reply-To
<Pine.LNX.4.64.0707221719430.14781@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 10 quoted lines
> 
> There is some funny code generation going on to make the context menu,
> and the messages for this have to be doubly quoted.
> 
> Noticed by Harri Ilari Tapio Liusvaara
> 
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  git-gui.sh |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
I'll try to rewrite this hunk as a procedure, to get rid of the
double evaluation problem.  However...
 
Show 10 quoted lines
> diff --git a/git-gui.sh b/git-gui.sh
> index 075a2b9..52170ee 100755
> --- a/git-gui.sh
> +++ b/git-gui.sh
> @@ -2457,9 +2457,9 @@ bind_button3 $ui_diff "
>  	set cursorX %x
>  	set cursorY %y
>  	if {\$ui_index eq \$current_diff_side} {
> -		$ctxm entryconf $ui_diff_applyhunk -label [mc {Unstage Hunk From Commit}]
> +		$ctxm entryconf $ui_diff_applyhunk -label \"[mc "Unstage Hunk From Commit"]\"

That's the wrong change to do here, as you are going to eval the result of the translation. If the translation had a Tcl special character (\, $, [) in it then we'd actually execute that. Instead the [ should be escaped:

> +		$ctxm entryconf $ui_diff_applyhunk -label \[mc "Unstage Hunk From Commit"\]
But you aren't a Tcl programmer, so its OK.  ;-)
-- 
Shawn.
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 2 of 3 in “git-gui-i18n: Fix translation of the context menu”
  1. git-gui-i18n: Fix translation of the context menuJohannes Schindelin, Jul 22, 2007
  2. Shawn O. PearceJul 23, 2007
  3. Johannes SchindelinJul 23, 2007

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.